PHP Class Cml\Secure

Show file Open project: linhecheng/cmlphp Class Usage Examples

Public Methods

Method Description
addslashes ( mixed &$var ) : mixed 增强的addslashes
checkCsrf ( integer $type = 1 ) 防止csrf跨站攻击
checkToken ( ) : boolean 类加载-检测token值
filterAll ( &$var ) * 加强型过滤
filterScript ( string $value ) : string 过滤javascript,css,iframes,object等标签
filterSql ( $value ) : string 过滤sql语句
filterStr ( string $value ) : string 过滤特殊字符
getToken ( ) : string 类加载-获取全局TOKEN,防止CSRF攻击
htmlspecialchars ( mixed &$var ) : mixed 增强的htmlspecialchars
htmlspecialcharsDecode ( mixed &$var ) : mixed 增强的htmlspecialchars_decode
setToken ( ) : void 类加载-设置全局TOKEN,防止CSRF攻击
stripTags ( mixed &$var ) : mixed 增强的strip_tags
stripslashes ( mixed &$var ) : mixed 增强的stripslashes

Method Details

addslashes() public static method

增强的addslashes
public static addslashes ( mixed &$var ) : mixed
$var mixed 要过滤的变量字符串或数组
return mixed 处理后的变量

checkCsrf() public static method

防止csrf跨站攻击
public static checkCsrf ( integer $type = 1 )
$type integer 检测类型 0不检查,1、只检查post,2、post get都检查

checkToken() public static method

@return bool
public static checkToken ( ) : boolean
return boolean

filterAll() public static method

* 加强型过滤
public static filterAll ( &$var )

filterScript() public static method

过滤javascript,css,iframes,object等标签
public static filterScript ( string $value ) : string
$value string 需要过滤的值
return string

filterSql() public static method

过滤sql语句
public static filterSql ( $value ) : string
$value
return string

filterStr() public static method

过滤特殊字符
public static filterStr ( string $value ) : string
$value string 需要过滤的值
return string

getToken() public static method

@return string
public static getToken ( ) : string
return string

htmlspecialchars() public static method

增强的htmlspecialchars
public static htmlspecialchars ( mixed &$var ) : mixed
$var mixed 要过滤的变量 字符串或数组
return mixed 处理后的变量

htmlspecialcharsDecode() public static method

增强的htmlspecialchars_decode
public static htmlspecialcharsDecode ( mixed &$var ) : mixed
$var mixed 要过滤的变量 字符串或数组
return mixed 处理后的变量

setToken() public static method

@return void
public static setToken ( ) : void
return void

stripTags() public static method

增强的strip_tags
public static stripTags ( mixed &$var ) : mixed
$var mixed 要过滤的变量 字符串或数组
return mixed 处理后的变量

stripslashes() public static method

增强的stripslashes
public static stripslashes ( mixed &$var ) : mixed
$var mixed 要过滤的变量字符串或数组
return mixed 处理后的变量