Here is a sample script that utilizes “whosonline.php” to display how many users are online. Read the documentation if you have any questions.
Plain Text Version
<?php /** * WhosOnline test file * @author pyr0t3chnician */ include("whosonline.php"); session_start(); //Create your connection $who=new WhosOnline('localhost','root','','who'); //Set up the table you will use $who->TableSet("online", true); //Update the table with the new data $who->Update(); //Echos the data echo $who->Data()."<br>"; //Uses images to display the data (like a counter!) $who->SetImage(0,"http://wikitriz.editme.com/files/Home/Number0.gif"); $who->SetImage(1,"http://wikitriz.editme.com/files/Home/Number1.gif"); $who->SetImage(2,"http://wikitriz.editme.com/files/Home/Number2.gif"); $who->SetImage(3,"http://wikitriz.editme.com/files/Home/Number3.gif"); $who->SetImage(4,"http://wikitriz.editme.com/files/Home/Number4.gif"); $who->SetImage(5,"http://wikitriz.editme.com/files/Home/Number5.gif"); $who->SetImage(6,"http://wikitriz.editme.com/files/Home/Number6.gif"); $who->SetImage(7,"http://wikitriz.editme.com/files/Home/Number7.gif"); $who->SetImage(8,"http://wikitriz.editme.com/files/Home/Number8.gif"); $who->SetImage(9,"http://wikitriz.editme.com/files/Home/Number9.gif"); echo $who->DisplayImages(); //For usernames, they must be a variable somewhere. $_SESSION['username']="bob"; $who->UpdateUser('username','SESSION'); //Update it again (add the username to the session id) $who->Update(); //Show data as an array print_r($who->Data("ARRAY")); ?>