+ Reply to Thread
Results 1 to 7 of 7

Thread: help with "users online" script

  1. #1
    cornishdubstep is offline x10Hosting Member cornishdubstep is an unknown quantity at this point
    Join Date
    Dec 2007
    Posts
    18

    help with "users online" script

    im not referring to the everyday users online script.

    I want a script that can show how many users are on a specific page, but from another page.


    its to go on a page showing all the chat rooms, i'd like a code to go next to each room showing how many users are on that page in the room, this way peeps know if anyones in there before they click into it, login and find its empty.... i hope i made more sense with this paragraph, ive searched the net for an answer, no joy yet

    cheers

  2. #2
    animerth is offline x10Hosting Member animerth is an unknown quantity at this point
    Join Date
    Dec 2007
    Posts
    86

    Re: help with "users online" script

    PM me with the chat program and i will see if i can help

  3. #3
    cornishdubstep is offline x10Hosting Member cornishdubstep is an unknown quantity at this point
    Join Date
    Dec 2007
    Posts
    18

    Re: help with "users online" script

    the chat rooms are are java, the script is used for each chat room (chat room being just a page with script).

    the page with the list of chat rooms is just a page with simple links to the pages containing this script.

    i just want to show the users on each of those pages next to the link
    Last edited by cornishdubstep; 01-05-2008 at 03:37 PM.

  4. #4
    animerth is offline x10Hosting Member animerth is an unknown quantity at this point
    Join Date
    Dec 2007
    Posts
    86

    Re: help with "users online" script

    sorry then i can't help you i am not good with java based chat

    IMO a php / flash based chat would work better

  5. #5
    galaxyAbstractor's Avatar
    galaxyAbstractor is offline Community Advocate galaxyAbstractor is on a distinguished road
    Join Date
    Oct 2007
    Location
    Land of Null and Insanity
    Posts
    5,495

    Re: help with "users online" script

    Maybe this if you have all links on a html/php page: http://cownt.us/

  6. #6
    naim4u's Avatar
    naim4u is offline x10Hosting Member naim4u is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    51

    Re: help with "users online" script

    firstly create a file : "online.txt" and chmod permission to 777(read,write,execute)
    use this below code.
    <?php

    function online_users()
    {
    $log_file = "online.txt";
    $min_online = "1";

    if ($HTTP_X_FORWARDED_FOR == "")
    {
    $ip = getenv(REMOTE_ADDR);
    }
    else
    {
    $ip = getenv(HTTP_X_FORWARDED_FOR);
    }

    $day = date("d");
    $month = date("m");
    $year = date("Y");
    $date = "$day-$month-$year";

    $ora = date("H");
    $minuti = date("i");
    $secondi= date("s");
    $time = "$ora:$minuti:$secondi";

    $users_read = fopen("$log_file", "r");
    $users = fread($users_read, filesize("$log_file"));
    fclose($users_read);

    $to_write ="$ip|$time|$date";
    if($users==0)
    {
    $user_write = fopen("$log_file", "w");
    fputs($user_write , $to_write );
    fclose($user_write );
    }
    else
    {
    $users=explode("\n",$users);
    $user_da_tenere=array();

    while (list ($key, $val) = each ($users))
    {
    $user_sing=explode("|",$val);

    if($date==$user_sing[2])
    {
    $h=explode(":",$user_sing[1]);
    if($ip!=$user_sing[0])
    {
    if(($h[0]==$ora)and(($minuti-$h[1])<=$min_online))
    {
    $user_da_tenere[]=$val;
    }
    if(($h[0]==($ora-1))and((($minuti+2)-$h[1])<=$min_online))
    {
    $user_da_tenere[]=$val;
    }
    }
    }
    }

    $user_da_tenere[] = $to_write;
    $user_write = fopen("$log_file", "w");
    fputs($user_write , "" );
    fclose($user_write );

    while (list ($k, $v) = each ($user_da_tenere))
    {
    $new_file_log = fopen ("$log_file", "a");
    fwrite($new_file_log,"$v\n");
    fclose($new_file_log);
    }
    }
    $users_online_read = fopen("$log_file", "r");
    $users_online = fread($users_online_read, filesize("$log_file"));
    fclose($users_online_read);

    $users_online = explode("\n",$users_online);
    $n_u_online = count($users_online)-1;

    return $n_u_online;
    }

    echo online_users();
    ?>

  7. #7
    coolv1994 is offline x10 Elder coolv1994 is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    506

    Re: help with "users online" script

    Try webdesign.org, they have a php users online but it requires a database.

+ Reply to Thread

Similar Threads

  1. Any free traffic exchange script??
    By goodone in forum Scripts & 3rd Party Apps
    Replies: 2
    Last Post: 07-21-2008, 01:24 AM
  2. Replies: 8
    Last Post: 12-03-2007, 04:12 PM
  3. [OFF] Script Instillations (Now Accepting)
    By kryptonyte in forum The Marketplace
    Replies: 0
    Last Post: 08-02-2006, 02:15 AM
  4. Server UP time Script
    By dharmil in forum Scripts & 3rd Party Apps
    Replies: 2
    Last Post: 04-03-2006, 04:39 PM
  5. CGI - script, Advertisement _HELP.
    By kaliforna in forum Free Hosting
    Replies: 12
    Last Post: 06-02-2005, 06:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers