code_junkie

Allow only certain websites to access a PHP page

Nov 12th, 2011
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. Order allow, deny
  2. Deny from 192.168.0.10
  3. Deny from 212.155.
  4. Deny from 1.2.3.4 5.6.7.8 127.0.0.1
  5. Allow from all
  6.  
  7. Deny from all
  8. Allow from 1.2.3.4
  9.  
  10. <?
  11. $allowed[0]="xxx.xxx.xxx.xxx";
  12. $allowed[1]="yyy.yyy.yyy.yyy";
  13.  
  14. // add as many as you need
  15.  
  16. if (!in_array($_SERVER['REMOTE_ADDR'],$allowed)) header("HTTP/1.1 403 Forbidden");
  17. ?>
Add Comment
Please, Sign In to add comment