admin

[经典代码] php 安全过滤函数代码

function fliter_script($value) {

$value = preg_replace("/(javascript:)?on(click|load|key|mouse|error|abort|move|unload|change|dblclick|move|reset|resize|submit)/i","&111n\\2",$value);

$value = preg_replace("/(.*?)<\/script>/si","",$value);

$value = preg_replace("/(.*?)<\/iframe>/si","",$value);

$value = preg_replace ("//iesU", '', $value);

return $value;

}



function fliter_html($value) {

  return str_replace(array("&", '"', "'", "<", ">"), array("&", "\"", "'", "<", ">"), $value);

}



function fliter_sql($value) {

$sql = array("select", 'insert', "update", "delete", "\'", "\/\*", "\.\.\/", "\.\/", "union", "into", "load_file", "outfile");

$sql_re = array("","","","","","","","","","","","");

return str_replace($sql, $sql_re, $value);

}


#1楼
发帖时间:4月前   |   查看数:0   |   回复数:0
游客组