Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old March 14th, 2004, 11:23 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
PHP Code - Redirect and Block Country or Anonymous Surfers

This code allows webmasters to redirect surfers by country or anonymous IP. Set up your block list at Country Check (www.countrycheck.com) and then change 4 variables in the code:
1. The site you want allowed visitors access to;
2. The site url for not allowed visitors;
3. Your Country Check usernumber;
4. Your Country Check password.
5. Rename the page "index.php" and ftp. Make sure you have changed your original "index" filename to something else first.

php Code:
Original - php Code
  1.  
  2.  
  3. <?php
  4.  
  5. $ok='http://www.YOURSITE.com/ALLOWEDPAGE';
  6. $not='http://www.YOURSITE.com/NOTALLOWEDPAGE';
  7. $ip=$_SERVER['REMOTE_ADDR'];
  8.  
  9. $fp = @fsockopen("countrycheck.com", 80, $errno, $errstr, 10);
  10. if(!$fp)
  11. {}
  12. else
  13. {
  14.     $result = '';
  15.     @fputs($fp,"GET http://www.countrycheck.com/ip.aspx?u=USERNUMBER&p=PASSWORD&t=1&ip=$ip HTTP/1.0rnHost: $_SERVER[HTTP_HOST]rnrn");
  16.     @socket_set_timeout($fp, 10);
  17.     while(!@feof($fp))
  18.     {
  19.         $result .= @fgets($fp, 1024);
  20.     }
  21.     @fclose($fp);
  22. }
  23.  
  24. if(strpos($result, 'NO') === false) {
  25. header("Location: $ok");
  26. }
  27. else {
  28. header("Location: $not");
  29. }
  30. ?>
  31.  

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > PHP Code - Redirect and Block Country or Anonymous Surfers


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT