Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2007
    Posts
    1,757
    Tokens
    105

    Latest Awards:

    Default How many people are viewing your site script.

    Does anyone know a script that displays how many people are viewing this site. So like "There are 67 people viewing this site"

    ++REP
    Get back imma let my gat go,
    got a itchy finger... imma leave a fat hole.
    - Giggs :: Ruthless Freestyle

    I owe rep to - .:Jack120:. HabbDance

  2. #2
    Join Date
    Feb 2008
    Location
    Plymouth
    Posts
    1,073
    Tokens
    0

    Latest Awards:

    Default

    Make a folder called whosonline. In the folder make a file called online.php, insert this code into it.

    PHP Code:
    <?


    $ip 
    $REMOTE_ADDR;
    $time time();
    $minutes 15;
    $found 0;
    $users 0;
    $user  "";

    $tmpdata $DOCUMENT_ROOT."/whosonline/data";

    if (!
    is_file("$tmpdata/online.txt"))    
        {
        
    $s fopen("$tmpdata/online.txt","w");
        
    fclose($s);
        
    chmod("$tmpdata/online.txt",0666);
        }

    $f fopen("$tmpdata/online.txt","r+");
    flock($f,2);

    while (!
    feof($f))
        {
        
    $user[] = chop(fgets($f,65536));
        }

    fseek($f,0,SEEK_SET);
    ftruncate($f,0);

    foreach (
    $user as $line)
        {
        list(
    $savedip,$savedtime) = split("\|",$line);
        if (
    $savedip == $ip) {$savedtime $time;$found 1;}
        if (
    $time $savedtime + ($minutes 60)) 
            {
            
    fputs($f,"$savedip|$savedtime\n");
            
    $users $users 1;
            }
        }

    if (
    $found == 0
        {
        
    fputs($f,"$ip|$time\n");
        
    $users $users 1;
        }

    fclose ($f);
    print 
    "$users are online
    "
    ;
    ?>
    Make another folder in the whoseonline folder and call it data. In that folder make a file called online.txt and put this in :
    PHP Code:
    66.235.180.56|1116831431 
    Now whichever page you want it to display on insert this:
    PHP Code:
    <? include"http://www.yoursite.com/whosonline/online.php";?>
    NOTE: This isn't my script!

  3. #3
    Join Date
    Nov 2007
    Location
    London
    Posts
    1,577
    Tokens
    36

    Latest Awards:

    Default

    This script wouldn't work if you don't do any CHMODing CHMOD the online.txt file to 777
    Kind Regards,

    Guy
    __________________

    Since 2007. Unbelievable Uptime. Web hosting, resellers, master resellers, linux VPS, windows VPS, shoutcasts, at the lowest prices on the net.
    Tech-Hosts.co.uk.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •