Who's Online

Forum
Last Post
Threads / Messages

Milly Money

Pet-Sim.Online
Staff member
Dev Staff
Joined
Jan 27, 2010
Messages
538
Points
18
Mysidian Dollar
28,331
1. Add a field in the users table :

online int(80) Not Null Default 0



2. find this in Profile.php and add the online part to the query:



$query = "SELECT * FROM ".$prefix."users ORDER BY usergroup ASC LIMIT $offset, $rowsperpage";
$result = mysql_query($query);
$num2 = mysql_numrows($result);

//Loop out code
$i=0;
while ($i < $num2) {

$id=@mysql_result($result,$i,"uid");
$username=@mysql_result($result,$i,"username");
$email=@mysql_result($result,$i,"email");
$level=@mysql_result($result,$i,"usergroup");
$online=@mysql_result($result,$i,"online");


$star = "";


3. THEN add close under that:


if($online == 1){

// Show a sun if online

$sun = "<img src='templates/icons/sun.gif' border=0'> ";
}

else if($online == 0){

// Show something else for offline

$sun = "<img src='templates/icons/moon.gif' border=0'> ";
}



//I am using sun and moon, you can use whatever lol //


4. Find this in the same page and change to add in the gif:


$article_content = $article_content."<b><a href='profile.php?user=".$username."'>".$sun."".$star."".$status."".$username."</a></b><br>";



5. upload enter.php:


6. Alter this part of login.php to say:


if($username == $luser and $password == $lpass){

$article_title = "Login Successful!";
$article_content = "Welcome back ".$username.". You are now logged in. <a href='enter.php'>Click Here to enter!</a>";



//We are routing them to go through the page that enters the online info!//


7. upload exit.php


8. Edit your log out link to go to exit.php.


9. upload online_list.php ---- this is online only!



The big thing here is to force members to go through an entry and exit page that will make them designated as 'online' or 'offline'! I don't think I forgot anything but I might have, so back up back up!! :)

Remember I might have something a bit different so alter as needed!!
 

Attachments

  • online_list.php
    9.9 KB · Views: 7
  • enter.php
    2.8 KB · Views: 5
  • exit.php
    2.8 KB · Views: 5
Last edited:
Wow this! Thank you so much for doing a whos online script Anna, I will test it myself on a demo site and see if it should be added to next release of Mysidia Adoptables.

Hall of Famer
 
Great, let me know how it works out, it's been working for me fine!


The whole key is really making sure the log on and off happens through the pages you route it all through! :)
 
welcome!! I wanted one of these too for a long time, finally figured out how to do it!!
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,118
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top