scriptz-team

[PHP] Protect site against bad/hack URL requests

Apr 26th, 2012
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <?php
  2. /* _____ _____ _ _____ _____ _____ _____ _____ _____
  3. ___| | __ |_| _ |_ _|___ ___|_ _| __| _ | |
  4. |_ -| --| -| | __| | | |- _|___| | | | __| | | | |
  5. |___|_____|__|__|_|__| |_| |___| |_| |_____|__|__|_|_|_|
  6. |s C R i P T z - T E A M . i N F O|----------------------------
  7.  
  8. [PHP] Protect site against bad/hack URL requests
  9. */
  10. define("REQUEST_LENGHT", "255");
  11.  
  12. if (strlen($_SERVER['REQUEST_URI']) > REQUEST_LENGHT || stripos($_SERVER['REQUEST_URI'], "eval(") ||
  13. //stripos($_SERVER['REQUEST_URI'], "_just_some_hack_") ||
  14. stripos($_SERVER['REQUEST_URI'], "../")) {
  15. @header("HTTP/1.1 414 Request-URI Too Long");
  16. @header("Status: 414 Request-URI Too Long");
  17. @header("Connection: Close");
  18. @exit;
  19. }
  20. ?>
Add Comment
Please, Sign In to add comment