Last active
August 29, 2015 13:57
-
-
Save ddbs/9403910 to your computer and use it in GitHub Desktop.
wordpress security: avoid requests from malicious urls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global $user_ID; | |
if($user_ID) { | |
if(!current_user_can('administrator')) { | |
if (strlen($_SERVER['REQUEST_URI']) > 255 || | |
stripos($_SERVER['REQUEST_URI'], "eval(") || | |
stripos($_SERVER['REQUEST_URI'], "CONCAT") || | |
stripos($_SERVER['REQUEST_URI'], "UNION+SELECT") || | |
stripos($_SERVER['REQUEST_URI'], "base64")) { | |
@header("HTTP/1.1 414 Request-URI Too Long"); | |
@header("Status: 414 Request-URI Too Long"); | |
@header("Connection: Close"); | |
@exit; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment