Ok, make a new file called
usersonline.php add this in:
Code:
<?
$server = "localhost"; // Your MySQL Server (usually "localhost")
$db_user = username"; // Your MySQL Username
$db_pass = "password"; // Your MySQL Password
$database = "database"; // Database Name
$timeoutseconds = 300; // Timeout Value in Seconds
//DONT EDIT MORE
$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 VALUES ('$timestamp','$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 FROM useronline WHERE file='$PHP_SELF'") or die("Useronline Database SELECT Error");
$user =mysql_num_rows($result);
mysql_close();
if ($user==1) {echo"<font size=1>There is currently $user Users viewing this page.</font>";} else {echo"<font size=1>There are currently $user users viewing this page.";}
?>
Save it and upload it to your servers root folder, now on your
index.php file add this somewhere on the page's code:
Code:
<?php include("useronline.php"); ?>
Now upload your edited index.php and enjoy the result.
once again, i thank you for reading this.(if u read it)
-Elvadar