Php help Wanted From A Php Freak Quickly !!

Discussion in 'PHP' started by dariusd, May 19, 2006.

  1. #1
    HY

    This is a piece of a online user php. The count goes +1 if a visitor connect to the website. I want the counter goes +4 when one visitor is online . When number 2 is online ithe counter goes +8 . The third is online goes + 16 and further ..., 4 gives 32, 5 give 64 ....

    example
    visitor 1 ONLINE SHOWS 4
    visitor 2 ONLINE SHOWS 12
    visitor 3 ONLINE SHOWS 28
    visitor 4 ONLINE SHOWS 32
    visitor 5 ONLINE SHOWS 64
    etc..........
    ....

    HELP WANTED FROM A PHP FREAK QUICKLY !!

    THX DUDE


    //Fetch Time
    $timestamp = time();
    $timeout = $timestamp - $timeoutseconds;

    //Insert User
    $insert = mysql_db_query($database, "INSERT INTO $table VALUES
    ('$timestamp','$REMOTE_ADDR','$PHP_SELF')") or die("Failed!");

    //Delete User
    $delete = mysql_db_query($database, "DELETE FROM $table WHERE timestamp<$timeout") or die("Failed!");

    //Fetch Users Online
    $result = mysql_db_query($database, "SELECT DISTINCT ip FROM $table WHERE file='$PHP_SELF'") or die("Failed!");
    $users = mysql_num_rows($result);

    //spit out the results
    if($users == 1) {
    print("Online users : $users\n");
    } else {
    print("Online users : $users\n");
    }
     
    dariusd, May 19, 2006 IP
  2. dariusd

    dariusd Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Find It Myself; Post Closed Bye
     
    dariusd, May 19, 2006 IP
  3. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #3
    In otherwords you want to pretend there's an exponential number of people online to what there actually is? lol

    Well, firstly from the numbers you gave there is no unique pattern to what you're wanting to show as you start off with 2(x-1)+4 and then break off into some other formula which makes no sense.


    Try

    $displayusers = (2*($users-1))+4;

    By the way, do you really expect to get any help when you say you need help from "freaks"?
     
    Weirfire, May 19, 2006 IP
  4. Dejavu

    Dejavu Peon

    Messages:
    916
    Likes Received:
    53
    Best Answers:
    0
    Trophy Points:
    0
    #4
    He was hoping for help from Nintendo ;)
     
    Dejavu, May 19, 2006 IP
  5. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #5
    lol I think you're right Dejavu. Although he'd have to ask Perl or htaccess questions to get help from Nintendo.
     
    Weirfire, May 19, 2006 IP