View Full Version : People Online Help!
lMattz
09-11-2005, 08:52 PM
Hey, i was wondering what the php code is for this, of course it changes when people come onto the site.
People Online: 0
Thanks
Matt
nelly
09-11-2005, 09:06 PM
try http://www.dynamicdrive.com/
- Nelly
splintercell!
10-11-2005, 07:48 AM
:| thats a dhtml and javascript site fool..
<?
/*This snippet will display a welcome message depending on the time of day
You can change the messages displayed below.
Feel free to use and modify to your liking.
Visit glomer.net for more information or e-mail:
tate at tatenations dot com
USAGE:
Simply plug into your site and change the messages to whatever you want.
*/
//Change the messages to what you want.
$afternoon = " ";
$evening = " ";
$late = " ";
$moring = " ";
//No need to edit any further
//Get the current hour
$current_time = date(G);
//Get the current day
$current_day = date(l);
//12 p.m. - 5 p.m.
if ($current_time >= 12 && $current_time <= 17) {
echo $afternoon;
}
// 6 p.m. to 11 p.m.
elseif ($current_time >= 18 && $current_time <= 24) {
echo $evening;
}
//12 a.m. - 5 a.m.
elseif ($current_time >= 1 && $current_time <= 5) {
echo $late;
}
// 6 a.m. to 11 a.m.
elseif ($current_time >= 6 && $current_time <= 11) {
echo $morning;
}
echo "<b>Time:</b> ";
$date = date("m/j/y");
$time =date('H:i:s');
echo "$time <br> <b>Date:</b> $date<br>"
?>
<?
$remote = $_SERVER["REMOTE_ADDR"];
$file = "usersonline.txt";
$timeoutseconds = 60; //Tells how long the user is considered "on line"
$timestamp = time();
$timeout = ($timestamp-$timeoutseconds);
$fp = fopen("$file", "a+");
$write = $remote."||".$timestamp."\n";
fwrite($fp, $write);
fclose($fp);
$online_array = array();
$file_array = file($file);
foreach($file_array as $newdata){
list($ip, $time) = explode("||", $newdata);
if($time >= $timeout){
array_push($online_array, $ip);
}
}
$online_array = array_unique($online_array);
$online = count($online_array);
if($online == "1"){
echo "<b>Habbos Online:</b> $online ";
}else{
echo "<br><b>Habbos Online:</b> $online ";
}
?>
<?
echo " <br><b>Hits:</b> "
?>
<?
$file = "counter.txt";
$open = fopen($file, "r");
$size = filesize($file);
$count = fread($open, $size);
$count1 = $count+1;
echo($count1);
fclose($open);
$open = fopen($file, "w");
fwrite($open, $count1);
fclose($open);
echo " ";
?>
hits.php
counter.txt
usersonline.txt
lMattz
10-11-2005, 06:05 PM
Nice code + Rep.
Flisker
11-11-2005, 12:53 PM
Wow... Well Done ;) +Rep
lMattz
11-11-2005, 04:17 PM
Post this in that code in the tutorial section. It rules
I don't have permission to post in that forum & thanks again for the rep.
I forgot to add the IP,
<?
$domain = GetHostByName($REMOTE_ADDR);
?>
lMattz
12-11-2005, 10:43 AM
:o Nice!. You should try and get permission xD
Lol. There's no point. ;)
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.