Return to Snippet

Revision: 33848
at October 14, 2010 06:29 by sjacunningham


Initial Code
//SANITIZE ALL DATA
	$_GET = array_map('trim', $_GET);
	$_POST = array_map('trim', $_POST);
	$_COOKIE = array_map('trim', $_COOKIE);
	$_REQUEST = array_map('trim', $_REQUEST);
	if(get_magic_quotes_gpc()):
		$_GET = array_map('stripslashes', $_GET);
		$_POST = array_map('stripslashes', $_POST);
		$_COOKIE = array_map('stripslashes', $_COOKIE);
		$_REQUEST = array_map('stripslashes', $_REQUEST);
	endif;
	$_GET = array_map('mysql_real_escape_string', $_GET);
	$_POST = array_map('mysql_real_escape_string', $_POST);
	$_COOKIE = array_map('mysql_real_escape_string', $_COOKIE);
	$_REQUEST = array_map('mysql_real_escape_string', $_REQUEST);

Initial URL

                                

Initial Description

                                

Initial Title
PHP sanitize variables

Initial Tags
php

Initial Language
PHP