Home  >  Article  >  Backend Development  >  PHP effective and secure filtering get, posd, cookie_PHP tutorial

PHP effective and secure filtering get, posd, cookie_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:53:41870browse

php 有效安全过滤get,posd,cookie

php 有效安全过滤get,posd,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]));
}

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/632373.htmlTechArticlephp 有效安全过滤get,posd,cookie php 有效安全过滤get,posd,cookie session_set_cookie_params(0, COOKIE_PATH, COOKIE_DOMAIN); if($_REQUEST) { if(MAGIC_QUOTES_GPC) { $_REQUES...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn