SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Git-R-Done
    Join Date
    Nov 2001
    Posts
    1,194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How Can I Exclude Two IP Addresses?

    I wrote a script to log a visitors IP address in a file. I need to make it so it will not add two different IP Addresses that are from my host's monitoring software which hits my server once a minute. Can somebody tell me how to do this?

    Here is the script that pertains the the IP address capture/storing:
    PHP Code:
    $IPAddress $_SERVER["REMOTE_ADDR"];

    if(!
    $visitorExists) {
    // Add a record for visitor
    @mysql_query("insert into visitors(IPAddress) values('$IPAddress')" );
    }

    // i need it to do something like
    @mysql_query("insert into visitors(IPAddress) values('$IPAddress') UNLESS IT IS FROM IP 255.0.0.1 OR 255.0.0.2" );

    Any help would be greatly appreciated.
    John Saunders

  2. #2
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $IPAddress $_SERVER["REMOTE_ADDR"];
    if(!
    $visitorExists && ($IPAddress != '255.0.0.1' && $IPAddress != '255.0.0.2'))
    {
      
    // Add a record for visitor
      
    @mysql_query("insert into visitors(IPAddress) values('$IPAddress')" );

    John

  3. #3
    Git-R-Done
    Join Date
    Nov 2001
    Posts
    1,194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    SWEET! Thank you John, it works great!
    John Saunders

  4. #4
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No problem.
    John


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
  •