很抱歉,里面一个调用错了。
用这个/*
* class slash is used to add or strip slashes in the post,get or cookies strings.
* method:strip ,to strip
* method:add,to add.
*
*/
class slash{
/*
* function strip is to strip the tag in the post ,get or cookies
* which was added by the system or by add function
*/
function strip()
{
if (get_magic_quotes_gpc()) {
function stripslashes_deep($value)
{
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value); return $value;
} $_POST = array_map('stripslashes_deep', $_POST);
$_GET = array_map('stripslashes_deep', $_GET);
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
}
}
/*
* add is to add slashes to post or get or cookie string,if the magic_quotes_gpc is set as 0,this
* function will worked.
*/
function add()
{
if (!get_magic_quotes_gpc()) {
$this->add_Slashes(&$_POST);
$this->add_Slashes(&$_GET);
}
}
function add_Slashes($pText) {
if ( is_array($pText) && count($pText) ) {
foreach ($pText as $pKey -> $pVal) {
$pText[$pKey] = $this->add_Slashes($pVal);
}
} else {
$pText=$this->addslashes($pText);
}
return $pText;
}
}
用这个/*
* class slash is used to add or strip slashes in the post,get or cookies strings.
* method:strip ,to strip
* method:add,to add.
*
*/
class slash{
/*
* function strip is to strip the tag in the post ,get or cookies
* which was added by the system or by add function
*/
function strip()
{
if (get_magic_quotes_gpc()) {
function stripslashes_deep($value)
{
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value); return $value;
} $_POST = array_map('stripslashes_deep', $_POST);
$_GET = array_map('stripslashes_deep', $_GET);
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
}
}
/*
* add is to add slashes to post or get or cookie string,if the magic_quotes_gpc is set as 0,this
* function will worked.
*/
function add()
{
if (!get_magic_quotes_gpc()) {
$this->add_Slashes(&$_POST);
$this->add_Slashes(&$_GET);
}
}
function add_Slashes($pText) {
if ( is_array($pText) && count($pText) ) {
foreach ($pText as $pKey -> $pVal) {
$pText[$pKey] = $this->add_Slashes($pVal);
}
} else {
$pText=$this->addslashes($pText);
}
return $pText;
}
}
解决方案 »
- 本地php上传gif为动态,将程序放到服务器上上传gif就变成静态的了,求解
- 一个无限分类的问题,已基本实现。请帮忙完善一下。
- 能否通过反射获取PHP扩展库中方法的参数?
- file_get_contents不能用于英文网站吗?
- socket这个东西,小弟一直很模糊!求大哥简单讲解!
- 求助一個奇怪的問題 在线等, 急急急
- 急——全屏打开窗口不行,双引号的问题
- 请问如何通过PHP来控制SERV_U FTP的用户及密码等系统设置呢?
- 关于PHP变量的问题
- 做搜索查询的时候 怎么拆分词?
- [旧瓶装新酒]关于apache+php+mysql
- 大家谈一下,基于PHP+mysql的搜索,怎么样做效率能最佳++++
# 此为头文件
define("PHP_MAGIC_GPC", get_magic_quotes_gpc());
function raddslashes(&$data)
{
if(!PHP_MAGIC_GPC)
{
return is_array($data) ? array_map('raddslashes',$data) : addslashes($data);
}
else
{
return $data;
}
}
$_GET = raddslashes($_GET);
$_POST = raddslashes($_POST);
?>