SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast uni's Avatar
    Join Date
    Aug 2003
    Location
    East Coast
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    No ads for certain IP addresses?

    Is there a way that I could make my ads appear for everyone except for 2 to 3 people?
    - un1x
    Content Sites:A|B
    Blogs:My Blog

  2. #2
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah. Just don't display the code if the IP is X or X.

  3. #3
    SitePoint Enthusiast uni's Avatar
    Join Date
    Aug 2003
    Location
    East Coast
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by someonewhois
    Yeah. Just don't display the code if the IP is X or X.
    Any idea on how I go about doing this in PHP?
    - un1x
    Content Sites:A|B
    Blogs:My Blog

  4. #4
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can use $_SERVER['REMOTE_ADDR'] to get the IP address, and then just go if ($_SERVER['REMOTE_ADDR'] != '123.123.123.123') { ...ad code... }.

  5. #5
    SitePoint Enthusiast uni's Avatar
    Join Date
    Aug 2003
    Location
    East Coast
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks someonewhois.
    - un1x
    Content Sites:A|B
    Blogs:My Blog

  6. #6
    SitePoint Guru kidbuu's Avatar
    Join Date
    Jan 2005
    Location
    Southtown City
    Posts
    685
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can also use a .htaccess file with:

    order allow,deny
    deny from IP1
    deny from IP2
    deny from IP3
    allow from all
    That will block these IPs from your whole server if you create this .htaccess file in the root directory.

  7. #7
    SitePoint Enthusiast uni's Avatar
    Join Date
    Aug 2003
    Location
    East Coast
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kidbuu
    You can also use a .htaccess file with:



    That will block these IPs from your whole server if you create this .htaccess file in the root directory.
    But I don't need to block the users. I just need to block ads for certain IPs.
    - un1x
    Content Sites:A|B
    Blogs:My Blog

  8. #8
    SitePoint Guru kidbuu's Avatar
    Join Date
    Jan 2005
    Location
    Southtown City
    Posts
    685
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by uni
    But I don't need to block the users. I just need to block ads for certain IPs.
    You got me there

    Then the php method should do the trick, as told above.


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
  •