Created
June 4, 2019 02:29
-
-
Save CeoFred/32fc6832bb89557921302f3be989e70f to your computer and use it in GitHub Desktop.
An algorithm to check for request parameters with _urls and validate them
This file contains hidden or 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
| foreach ($_REQUEST as $key => $value) { | |
| $ex = explode('_',$key); | |
| foreach ($ex as $k => $v) { | |
| if($v == 'url'){ | |
| $url = filter_var($value,FILTER_VALIDATE_URL,FILTER_FLAG_HOST_REQUIRED); | |
| if(!$url){ | |
| http_response_code(403); | |
| echo $Job->validationFailed('Website must be valid',$key . ' should match http://www.examplesite.com, attach protocol'); | |
| return; | |
| } | |
| } | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment