无法停止 PHP 中 msg 字段中的垃圾邮件 url 链接已进行 preg_match() 检查,但它也被绕过了。
这怎么可能是我的代码:
if($_SESSION['captcha_code']==$_POST['captcha'])
{
$regex = "/(http:\/\/|)(www.|)[\d\w-]{2,63}\.[A-Z]{2,4}(\.[A-Z]{2,4}|)/i";
if (preg_match($regex,$_POST['message'],$match))
{
echo '<script>alert("URL links are not allowed, please remove following URL link from the message");window.history.go(-1);</script>'; return;
}