Php effectively and securely filters get, posd, and cookie
Php effectively and securely filters get, posd, and cookie
Session_set_cookie_params (0, COOKIE_PATH, COOKIE_DOMAIN );
If ($ _ REQUEST)
{
If (MAGIC_QUOTES_GPC)
{
$ _ REQUEST = new_stripslashes ($ _ REQUEST );
If ($ _ COOKIE) $ _ COOKIE = new_stripslashes ($ _ COOKIE );
}
Else
{
$ _ POST = new_addslashes ($ _ POST );
$ _ GET = new_addslashes ($ _ GET );
$ _ COOKIE = new_addslashes ($ _ COOKIE );
@ Extract ($ _ POST );
@ Extract ($ _ GET );
@ Extract ($ _ COOKIE );
}
If (! Defined ('in _ admin') $ _ REQUEST = filter_xss ($ _ REQUEST, ALLOWED_HTMLTAGS );
Extract ($ db-> escape ($ _ REQUEST), EXTR_SKIP );
If ($ _ COOKIE) $ db-> escape ($ _ COOKIE );
}
If (QUERY_STRING & strpos (QUERY_STRING, '=') ===false & preg_match ("/^ (. *). (htm | html | shtm | shtml) $/", QUERY_STRING, $ urlvar ))
{
Parse_str (str_replace (array ('/', '-', ''), array ('&', '=',''), $ urlvar [1]);
}