Runescape Bits & Bytes https://www.rsbandb.com/forums/ |
|
Another Newbie Tutorial - Users Browsing https://www.rsbandb.com/forums/viewtopic.php?f=38&t=14360 |
Page 1 of 1 |
Author: | Elvadar [ August 1st, 2005, 9:51 am ] |
Post subject: | Another Newbie Tutorial - Users Browsing |
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 |
Author: | Adbot [ August 1st, 2005, 9:51 am ] |
Post subject: | Register and login to get these in-post ads to disappear |
Author: | Jeff [ August 1st, 2005, 11:27 am ] |
Post subject: | |
Well, perhaps another db.sql script for the databases needed to be created ![]() |
Page 1 of 1 | All times are UTC - 7 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |