php get post传递数据 安全问题_PHP教程
程序员文章站
2022-04-19 12:49:11
...
php get post post方式传递数据 post get php post get post区别 php 参数传递 http get post post和get的区别 get与post的区别 post和get
/**
* @name date safe class 0.1
* @author kevin xu
* @copyright kenvin E-mail:gincn@cn.cashboxparty.com MSN:gincn@live.cn
*/
interface dateSafe{
function gincn();
}
class safe extends doSafe implements dateSafe
{
public $safe;
function __construct($safe)
{
parent::__construct($safe); //调用父类构造函数,网友javachen找出来的错误
$this->safe = $safe;
}
function gincn()
{
$this->safe = parent::xss($this->safe);
$this->safe = parent::sql($this->safe);
return $this->safe;
}
}
class doSafe
{
protected $str;
function __construct($str)
{
$this->str = $str;
}
function xss()
{
$this->str = trim($this->str); //清理空格字符
$this->str = nl2br($this->str); //将换行符转化为
$this->str = strip_tags($this->str); //过滤文本中的HTML标签
$this->str = htmlspecialchars($this->str); //将文本中的内容转换为HTML实体
$this->str = addslashes($this->str); //加入字符转义
return $this->str;
}
function sql()
{
$this->str = mysql_escape_string($this->str);
return $this->str;
}
}
/**
* @name date safe class 0.1
* @author kevin xu
* @copyright kenvin E-mail:gincn@cn.cashboxparty.com MSN:gincn@live.cn
*/
interface dateSafe{
function gincn();
}
class safe extends doSafe implements dateSafe
{
public $safe;
function __construct($safe)
{
parent::__construct($safe); //调用父类构造函数,网友javachen找出来的错误
$this->safe = $safe;
}
function gincn()
{
$this->safe = parent::xss($this->safe);
$this->safe = parent::sql($this->safe);
return $this->safe;
}
}
class doSafe
{
protected $str;
function __construct($str)
{
$this->str = $str;
}
function xss()
{
$this->str = trim($this->str); //清理空格字符
$this->str = nl2br($this->str); //将换行符转化为
$this->str = strip_tags($this->str); //过滤文本中的HTML标签
$this->str = htmlspecialchars($this->str); //将文本中的内容转换为HTML实体
$this->str = addslashes($this->str); //加入字符转义
return $this->str;
}
function sql()
{
$this->str = mysql_escape_string($this->str);
return $this->str;
}
}
?>
推荐阅读
-
PHP中使用socket方式GET、POST数据实例教程
-
PHP中使用socket方式GET、POST数据实例_php实例
-
WordPress开发中的get_post_custom()函数使用解析,wordpressgetpost_PHP教程
-
php 利用socket发送HTTP请求(GET,POST),socketget_PHP教程
-
PHP利用socket模拟post之fsockopen发送数据_PHP教程
-
php过滤所有恶意字符(批量过滤post,get敏感数据)_PHP教程
-
php fsockopen模仿用户post数据_PHP教程
-
如何POST一个JSON格式的数据给Restful服务,jsonrestful_PHP教程
-
php中用socket模拟http中post或者get提交数据的示例代码
-
php过滤所有恶意字符(批量过滤post,get敏感数据)