请教怎么用正则验证 or 1 = 1

WBOY
Release: 2016-06-13 12:04:11
Original
1651 people have browsed it

求助:请问如何用正则验证 or 1 = 1
目的为了防止mysql注入操作。
------解决方案--------------------
[\s\S]*?or[\s\S]*?\d+[\s\S]*?=[\s\S]*?\d+
------解决方案--------------------

$a = array(<br />  "or 1 = 1",<br />  "Or 1 = 1",<br />  "or 3 =3",<br />  "or now() = now()",<br />  "or 'a' = 'a'",<br />);<br /><br />foreach($a as $s)<br />  echo $s, " :\t\t", preg_match('/or\b.+(\b\w+\b)[^=]*=.*\1/i', $s), PHP_EOL;
Copy after login
or 1 = 1 :		1<br />Or 1 = 1 :		1<br />or 3 =3 :		 1<br />or now() = now() :	1<br />or 'a' = 'a' :		1<br /><br />
Copy after login
还有什么怪异的写法,你加进去自己试

Related labels:
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