很抱歉,里面一个调用错了。
用这个/*
* 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;
}
}
解决方案 »
- __autoload中能否知道类被哪个文件引用
- php使用GD库加文字水印如何实现换行
- 请较:如何输出二维数组内容
- iframe刷新的问题!请大家帮忙解决一下!谢谢!
- 急问,这个提示的错误怎么解决!!!
- PHP如何读取form 中select 传递过来的参数(还存在问题,急)
- 一个非常急的问题,请高手帮忙,初学的就别进来了
- 怎样取得当前页面的完整URL(包括?后边一串东西)?
- 怎样在php中设置charset,我的php输出都是乱码, 加在<meta>里好象没用
- XAMPP 启动不了 MySql
- [旧瓶装新酒]关于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);
?>