Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Another Newbie Tutorial - Users Browsing
PostPosted: August 1st, 2005, 9:51 am 
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


Top
  
 
 Post subject: Register and login to get these in-post ads to disappear
PostPosted: August 1st, 2005, 9:51 am 

Joined: September 9th, 2004, 1:47am
Posts: 9047
Location: In your web browserz


Top
  
 
 Post subject:
PostPosted: August 1st, 2005, 11:27 am 
Rsbandb Donor
User avatar
Offline

Joined: December 22nd, 2004, 12:51 am
Posts: 6391
RS Name: Stanley1943
RS Status: F2P
Well, perhaps another db.sql script for the databases needed to be created :wink:

_________________
Image


Top
 Profile  
 
Display posts from previous:  Sort by  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to: