I was making a contact form again and eregi() is being used on it. But as we all know, the eregi() function has been deprecated on PHP 5.3 so I want to know what alternative function/s can I use to replace the function eregi()? I've tried !preg_match and even though I get the desired output, there appears to be an error still! >3<
Warning: preg_match(): Delimiter must not be alphanumeric or backslash in C:\xampp\htdocs\Wall\mailform.php on line 38 (Possible spam attempt detected. If this is not the case, please edit the content of the contact form and try again.) - The sentence inside the () is the desired result.
This is the codes I used. !preg_match() used to be eregi(). :)
function spamcheck($field) {
if(!preg_match("to:",$field) || !preg_match("cc:",$field) || !preg_match("\r",$field) || !preg_match("\n",$field) || !preg_match("%0A",$field)){
$possiblespam = TRUE;
}else $possiblespam = FALSE;
if ($possiblespam) {
die("Possible spam attempt detected. If this is not the case, please edit the content of the contact form and try again.");
return 1;
}
}
Thank you to whoever is going to answer and help me. Any kind of help is very much appreciated!