Closed Thread
Results 1 to 6 of 6

Thread: Users online

  1. #1
    Guest roly is an unknown quantity at this point
    Join Date
    Dec 2001
    Posts
    1,461

    Wink Users online

    Does anyone know a script that shos the users online? It can be in Perl or PHP (yes it can use mySQL)

  2. #2
    FWS Addict Mika is an unknown quantity at this point
    Join Date
    Oct 2001
    Posts
    767
    http://www.hotscripts.com/PHP/Script...ers/Real-Time/
    -----------------------------------------------------------------------------------
    http://www.hotscripts.com/Perl/Scrip...ers/Real-Time/

  3. #3
    Senior Member invalid is an unknown quantity at this point invalid's Avatar
    Join Date
    Jan 2002
    Location
    United States
    Posts
    189
    curtosy of spoono.com

    PHP Code:
    <?php 
    //fill in some basic info
    $server "localhost"
    $db_user "username"
    $db_pass "password"
    $database "users"
    $timeoutseconds 300

    //get the time
    $timestamp time(); 
    $timeout $timestamp-$timeoutseconds

    //connect to database
    mysql_connect($server$db_user$db_pass); 

    //insert the values
    $insert mysql_db_query($database"INSERT INTO useronline VALUES
    ('$timestamp','$REMOTE_ADDR','$PHP_SELF')"
    ); 
    if(!(
    $insert)) { 
         print 
    "Useronline Insert Failed > "


    //delete values when they leave
    $delete mysql_db_query($database"DELETE FROM useronline WHERE timestamp<$timeout"); 
    if(!(
    $delete)) { 
        print 
    "Useronline Delete Failed > "


    //grab the results
    $result mysql_db_query($database"SELECT DISTINCT ip FROM useronline WHERE file='$PHP_SELF'"); 
    if(!(
    $result)) { 
        print 
    "Useronline Select Error > "


    //number of rows = the number of people online
    $user mysql_num_rows($result); 


    //spit out the results
    mysql_close(); 
    if(
    $user == 1) { 
    print(
    "$user user online\n"); 
    } else { 
    print(
    "$user users online\n"); 

    ?>
    Registered Linux User #258603 - http://counter.li.org/

  4. #4
    WOw I have a title shizzle is an unknown quantity at this point shizzle's Avatar
    Join Date
    Feb 2002
    Location
    Atlanta
    Posts
    1,552
    Try using cgi-resources.com. They have bunches more scripts than hotscripts.
    Xshare Logo Design- Portfolio
    AIM: IQPhat
    MSN: xshare101@hotmail.com
    Email: rhagigi@xshare.org

  5. #5

    ...

    Its called cgi-resources. Does that mean that its ALL cgi?? Cause PHP is better (in MY opinion... dont argue with me, I dont feel like it right now...), and faster. If it has PHP scripts too, id much rather go there. .

  6. #6
    Senior Member alien is an unknown quantity at this point
    Join Date
    Oct 2001
    Location
    .au/.sg
    Posts
    249

    Re: ...

    Originally posted by Lokannon
    Its called cgi-resources. Does that mean that its ALL cgi?? Cause PHP is better (in MY opinion... dont argue with me, I dont feel like it right now...), and faster. If it has PHP scripts too, id much rather go there. .
    http://php.resourceindex.com/

Closed Thread

Bookmarks

Posting Permissions

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