SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Counters

  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Location
    right....
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Counters

    Hi.

    I am fairly new to PHP, but I can do some stuff. Anyways, I was wondering how a counter for a web site would work? I know a basic idea on how I can set it up, but is there a function in PHP, which detects if a user has accessed your site? If not what is the alternative, so that my site/script knows that someone is present?

    Also, is there a function that will allow me, to gain the IP numbers of people visiting my site? NO i will not be using this for hacking, but to track people who try to get into a ftp site of a group of friends and I. ( We editted video games, and we are making a modifucation, and we dont want it release pre mature)

    Thank you for ya'll time
    Sorry Sarah

  2. #2
    SitePoint Evangelist ucahg's Avatar
    Join Date
    Apr 2001
    Location
    Sarnia, Ontario, Canada
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The IP address is contained in the global variable $REMOTE_ADDR. This will not work with all browsers, however.

  3. #3
    Node mutilating coot timnz's Avatar
    Join Date
    Feb 2001
    Location
    New Zealand
    Posts
    516
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When someone visits a page on your site, you just want to have a simple update query, where it updates a mysql table by one everytime that page is accessed. If you want to log their IP address then that is somewhat different and depends on the setup of the server whereby you are hosted, as on some $REMOTE_ADDR will work, and on others it will just give you the local, ie 127.0.0.1

    Some tutorials I found helpful were over at phpbuilder.com

    http://www.phpbuilder.com/columns/se...n19990331.php3
    http://www.phpbuilder.com/columns/mattias19990302.php3
    http://www.phpbuilder.com/columns/tim19990130.php3
    http://www.phpbuilder.com/columns/tim20001211.php3

    They explain the basics of setting it up with some examples and source code.

    Hope this helps

  4. #4
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Location
    right....
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanks!

    Thanks! I'll check em out
    Sorry Sarah


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
  •