Results 1 to 4 of 4

Thread: Question about visitors online PHP script

  1. #1
    Aquarezz's Avatar
    Aquarezz is offline Master Net Builder
    Join Date
    Dec 2008
    Location
    Belgium
    Posts
    3,846
    Blog Entries
    4
    Thanks
    683
    Thanked 590 Times in 462 Posts

    Question about visitors online PHP script

    Hello,
    I have this great PHP script to show how many people are currently visiting the page...
    But I want to know this:
    Script:
    Code:
    <?php
    $db=mysql_connect("localhost","user","pass") or die(mysql_error());
    mysql_select_db("user",$db);
    $time        = time();
    $clear_time  = $time - 600;
    $update_time = $time - 30;
    $ip          = $_SERVER['REMOTE_ADDR'];
    $onQuery = mysql_query("SELECT ip FROM c_online WHERE ip = '".$ip."' LIMIT 1") or die(mysql_error());
    $onCount = mysql_num_rows($onQuery);
    ....
    About the clear_time & update_time....

    If I want to make a longer session (instead of the time now)
    Do I need to raise the 600 & 30 or lower?
    As I see this $time MINUS 600...

    So normally I would raise it (for example to 6000), but as I see 'time' MINUS something it is maybe lowering it to 60 instead...

    Can someone help please?

    Greets
    |Nico Lawsons

  2. #2
    Shenron's Avatar
    Shenron is offline Administrator
    Join Date
    Dec 2008
    Location
    Portugal
    Posts
    1,900
    Blog Entries
    2
    Thanks
    561
    Thanked 548 Times in 368 Posts
    It would help if you could share where those 2 variables are being used.

    $clear_time
    $update_time

  3. #3
    Will.Spencer's Avatar
    Will.Spencer is offline Retired
    Join Date
    Dec 2008
    Posts
    5,033
    Blog Entries
    1
    Thanks
    1,010
    Thanked 2,327 Times in 1,258 Posts
    $update_time is the time 30 seconds ago; $clear_time is the time 600 seconds ago.

    $update_time is used to tell the script how often to update the database.

    $clear_time is used to tell the script how long to consider a visitor as "current."

    Thinking this through... if you want to raise the apparent number of visitors, you would want to extend those times, right? So you would raise the 600 number.

    Test it and see this results. Practice trumps theory.

    Source: Number of visitors online system in PHP.

    Submit Your Webmaster Related Sites to the NB Directory
    I swear, by my life and my love of it, that I will never live for the sake of another man, nor ask another man to live for mine.

  4. #4
    Aquarezz's Avatar
    Aquarezz is offline Master Net Builder
    Join Date
    Dec 2008
    Location
    Belgium
    Posts
    3,846
    Blog Entries
    4
    Thanks
    683
    Thanked 590 Times in 462 Posts
    Ow ok!
    Thanks a lot

    Greets
    |Nico Lawsons

Similar Threads

  1. [WTS] Online TV Script
    By chandan in forum Scripts
    Replies: 2
    Last Post: 3 February, 2011, 00:09 AM
  2. @proxy script question
    By Habaku in forum Web Proxies
    Replies: 3
    Last Post: 31 December, 2010, 19:20 PM
  3. @Proxy Script Question
    By Zash in forum Proxy List Support Forum
    Replies: 7
    Last Post: 3 July, 2010, 09:35 AM
  4. [WTS] Online clipboard script! 5$
    By ruben in forum Scripts
    Replies: 0
    Last Post: 18 March, 2010, 04:34 AM
  5. another at proxy script question
    By ProxySites.ca in forum Proxy List Support Forum
    Replies: 6
    Last Post: 6 February, 2010, 02:44 AM

Tags for this 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
  •