PHP Prevents JS Injection Regular_PHP Tutorial

WBOY
Release: 2016-07-20 11:16:40
Original
924 people have browsed it

   例子

代码如下  

$a ="/]*?>.*?/si";
$keyword = preg_replace($a,' ',$_POST['searchword']);

代码如下  

$a ="/]*?>.*?/si";
$keyword = preg_replace($a,' ',$_POST['searchword']);

  其它方法

代码如下  

$title="";
$title = strip_tags($title);
if(preg_match('/|<script>(.*)</script>|/',$title,$info)){
$title=$info['1'];
}else{
$title = $title;
}
echo $title;

代码如下  

$title="";
$title = strip_tags($title);
if(preg_match('/|<script>(.*)</script>|/',$title,$info)){
$title=$info['1'];
}else{
$title = $title;
}
echo $title;

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/372609.htmlTechArticleThe example code is as follows $a =/script[^]*?.*?/script/si; $keyword = preg_replace($a,' ',$_POST['searchword']); Other method codes are as follows?php $title=stylessss{'float:right'}/style; $titl...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!