Hi Rulain! Well with the help from another friend on sitepoint I came up with the following:
<?
#################################################################################################
Project : phpUseronline
File name : useronline.php
Version : 1.10
Last Modified By : Erich Fuchs
Purpose : Main File
Last modified : 20 Apr 2001
Copyright : 2001 by NETonE High Quality Networking (<a href="http://www.netone.at" target="blank"><a href="http://www.netone.at" target="blank">http://www.netone.at</a></a> )
#################################################################################################
Configuration
#################################################################################################
$server = "localhost"; // Your mySQL Server, most cases "localhost"
$db_user = ""; // Your mySQL Username
$db_pass = ""; // Your mySQL Password
$database = ""; // Database Name
$userid = $uid;
$timeoutseconds = 300; // Timeout value in seconds
End Configuration - DO NOT EDIT BEHIND THIS LINE !!!
#################################################################################################
$timestamp=time();
$timeout=$timestamp-$timeoutseconds;
mysql_connect($server, $db_user, $db_pass) or die ("Useronline Database CONNECT Error");
mysql_db_query($database, "INSERT INTO useronline (timestamp, userid, ip, file) VALUES ('$timestamp','$userid','$REMOTE_ADDR','$PHP_SELF')") or die("Useronline Database INSERT Error");
mysql_db_query($database, "DELETE FROM useronline WHERE timestamp<$timeout") or die("Useronline Database DELETE Error");
$result=mysql_db_query($database, "SELECT DISTINCT ip, userid FROM useronline WHERE userid=userid AND file='$PHP_SELF'") or die("Useronline Database SELECT Error");
$user =mysql_num_rows($result);
if ($user==1)
{
echo "You are the only person here right now.";
}
else
{
echo "There are $user people here right now.<br />\nThe following people are here: ";
while ($row = mysql_fetch_array($result))
{
$people[] = $row['userid'];
}
echo implode(', ', $people);
}
mysql_close();
?>
And it works to an extent. I had another friend get online and go to my link and I could see her name and mine on the page, but for her it said she was the only one there.
Any ideas?
Amanda