mxr156
12-23-2006, 11:14 PM
i have wrote a script that should show the users online on my website and it comes up with "Query was empty" when i open the pages that it is included on. Even when i log into the website it doesnt show on the users online.
This is the code that i have for updating the users last active time
if ( $login_username_num == 1 )
{
$login_password_sql = "SELECT user_username FROM noobsonline_users WHERE user_username='$_POST[f_username]' AND user_password=md5('$_POST[f_password]')";
$login_password_result = mysql_query($login_password_sql)
or die ("Couldnt Execute login_password Query");
$login_password_num = mysql_num_rows($login_password_result);
if ( $login_password_num > 0 )
{
$_SESSION['wOOtwOOt'] = "YEAH";
$login_username = $_POST['f_username'];
$_SESSION['login_username'] = $login_username;
$today = date("Y-m-d H:m:s");
$lastaction_sql = "UPDATE noobsonline_users SET user_lastaction='$today' WHERE user_username='$_SESSION[login_username]'";
mysql_query($lastaction_sql)
or die ("couldn't Update Last Action");
header("Location: index.php?page=usercp");
}
else
and this is the code that i have to select the users online from the database. If ainone could help me out with this it would be much apreciated. As i have looked nearly everywhere and cant find anything that has helped me as of yet
<?php
echo"<span class='Sheading'>Users Online</span><br /><br />
Users Online is based on the active users in the last five minutes<br /><br />";
$fivemin_ago = mktime(date("H"), date("i")-5, date("s"), date("m"), date("d"), date("Y"));
$fivemin_ago_ts = date("YmdHis", $fivemin_ago);
$online_sql = "SELECT user_ID,user_username,user_status FROM noobsonline_users WHERE user_lastaction > $fivemin_ago_ts";
$online_result = mysql_query($sql)
or die(mysql_error());
while ($row = mysql_fetch_array($result))
{
extract($row);
echo"<a href='index.php?page=profile&userid=$user_ID'>$user_username</a> ";
if ( $counter == 0 )
{
echo"";
}
$counter++;
}
echo"<br /><br />";
?>
Also if it was at all possible i would like the site to be viewed in GMT 0 as that is my time zone and would like the site to go by it. if that can be done even better
Thanks in advance
Andy
This is the code that i have for updating the users last active time
if ( $login_username_num == 1 )
{
$login_password_sql = "SELECT user_username FROM noobsonline_users WHERE user_username='$_POST[f_username]' AND user_password=md5('$_POST[f_password]')";
$login_password_result = mysql_query($login_password_sql)
or die ("Couldnt Execute login_password Query");
$login_password_num = mysql_num_rows($login_password_result);
if ( $login_password_num > 0 )
{
$_SESSION['wOOtwOOt'] = "YEAH";
$login_username = $_POST['f_username'];
$_SESSION['login_username'] = $login_username;
$today = date("Y-m-d H:m:s");
$lastaction_sql = "UPDATE noobsonline_users SET user_lastaction='$today' WHERE user_username='$_SESSION[login_username]'";
mysql_query($lastaction_sql)
or die ("couldn't Update Last Action");
header("Location: index.php?page=usercp");
}
else
and this is the code that i have to select the users online from the database. If ainone could help me out with this it would be much apreciated. As i have looked nearly everywhere and cant find anything that has helped me as of yet
<?php
echo"<span class='Sheading'>Users Online</span><br /><br />
Users Online is based on the active users in the last five minutes<br /><br />";
$fivemin_ago = mktime(date("H"), date("i")-5, date("s"), date("m"), date("d"), date("Y"));
$fivemin_ago_ts = date("YmdHis", $fivemin_ago);
$online_sql = "SELECT user_ID,user_username,user_status FROM noobsonline_users WHERE user_lastaction > $fivemin_ago_ts";
$online_result = mysql_query($sql)
or die(mysql_error());
while ($row = mysql_fetch_array($result))
{
extract($row);
echo"<a href='index.php?page=profile&userid=$user_ID'>$user_username</a> ";
if ( $counter == 0 )
{
echo"";
}
$counter++;
}
echo"<br /><br />";
?>
Also if it was at all possible i would like the site to be viewed in GMT 0 as that is my time zone and would like the site to go by it. if that can be done even better
Thanks in advance
Andy