Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Aug 2005
    Posts
    252
    Thanks
    23
    Thanked 0 Times in 0 Posts

    Ignore ip addresses in counter

    How can this be modified so that it will ignore a couple different ip addresses?

    PHP Code:
    <?php 
    $counternum 
    "_counters/products.txt"
    function 
    displayCounter($counternum) { 
         
    $fp fopen($counternum,rw); 
         
    $num fgets($fp,99999); 
         
    fclose($fp); 
         
    $fp fopen($counternum,w); 
         
    $num += 1
         print 
    "<div style=\"color:#fff\">$num</div>"
         
    fputs($fp$num); 
         
    fclose($fp); 

    displayCounter($counternum); 

    ?>

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Check the global variable $_SERVER['REMOTE_ADDR'] and bypass the function call if it matches the IP addresses you want to block.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •