Advertisement
kopilo

php - request data adjustment

Aug 4th, 2011
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.54 KB | None | 0 0
  1. function fixRequestData() {
  2. /* unescape request data */
  3. /* PHP doc claims for this to already been done, but I think it has to do with server setup. */
  4.     if($_SERVER['REQUEST_METHOD'] == 'GET') {
  5.         foreach ($_REQUEST as $key => $value) {
  6.             $_REQUEST[$key] = urldecode( $value );
  7.         }
  8.     }
  9. /* strip tags so that php/sql/html injection fails. */
  10.     foreach ($_REQUEST as $key => $value) {
  11.         $_REQUEST[$key] = strip_tags($value);
  12.     }
  13. }  
  14. /* run this function first as a safety precaution */
  15. fixRequestData();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement