Site stats on the login page

master
vitalif 2010-01-25 18:08:56 +00:00
parent 3948fe973b
commit f54a4978b1
2 changed files with 31 additions and 29 deletions

View File

@ -97,6 +97,13 @@ function fof_db_get_row($result)
return mysql_fetch_array($result);
}
function fof_db_get_value($sql)
{
if (!($result = fof_db_query($sql)) ||
!($row = fof_db_get_row($result)))
return NULL;
return $row[0];
}
////////////////////////////////////////////////////////////////////////////////
// Feed level stuff

View File

@ -28,6 +28,7 @@ if(isset($_POST["user_name"]) && isset($_POST["user_password"]))
exit();
}
elseif (!fof_db_get_user_id($_POST['user_name']) &&
function_exists('fof_authenticate_external') &&
fof_authenticate_external($_POST['user_name'], $_POST['user_password']))
{
fof_db_add_user($_POST['user_name'], $_POST['user_password']);
@ -41,41 +42,35 @@ if(isset($_POST["user_name"]) && isset($_POST["user_password"]))
$failed = true;
}
/* Site stats */
$users = fof_db_get_value("SELECT COUNT(*) FROM fof_user");
$feeds = fof_db_get_value("SELECT COUNT(*) FROM fof_feed");
$items = fof_db_get_value("SELECT COUNT(*) FROM fof_item");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Feed on Feeds - Log on</title>
<style>
body
{
font-family: georgia;
font-size: 16px;
}
div
{
background: #eee;
border: 1px solid black;
width: 20em;
margin: 5em auto;
padding: 1.5em;
}
</style>
</head>
<body>
<head>
<title>Feed on Feeds - Log on</title>
<style>
body { font-family: georgia; font-size: 16px; }
div { background: #eee; border: 1px solid black; width: 20em; margin: 5em auto; padding: 1.5em; }
form { margin: 0 0 0 -3px; }
</style>
</head>
<body>
<div>
<form action="login.php" method="POST" style="display: inline">
<form action="login.php" method="POST">
<center><a href="http://feedonfeeds.com/" style="font-size: 20px; font-family: georgia;">Feed on Feeds</a></center><br>
User name:<br><input type=string name=user_name style='font-size: 16px'><br><br>
Password:<br><input type=password name=user_password style='font-size: 16px'><br><br>
<input type=submit value="Log on!" style='font-size: 16px; float: right;'><br>
<?php if($failed) echo "<br><center><font color=red><b>Incorrect user name or password</b></font></center>"; ?>
User name:<br><input class="editbox" type='string' name='user_name' style='font-size: 16px; width: 20em'><br><br>
Password:<br><input class="editbox" type='password' name='user_password' style='font-size: 16px; width: 20em'><br><br>
<p style="text-align: right; margin: 0"><input type="submit" value="Log on!" style='font-size: 16px'></p>
<?php if($failed) echo '<br><center><font color="red"><b>Incorrect user name or password</b></font></center>'; ?>
<center style="padding: 20px 0 0 0; font-size: 75%"><?= "As of ".date("Y-m-d").", $users&nbsp;our&nbsp;users subscribed to $feeds&nbsp;unique&nbsp;feeds with $items&nbsp;items." ?></center>
</form>
</div>
</body>
</body>
</html>