0

unable to stop spam url links in msg field in PHP has put the preg_match() check but it also getting bypassed.

how it is possible here is my code:

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;
}

0 Answers0