I have an enquiry form on an old HTML website, this was working fine with an old version of PHP. The problem now is the Function eregi() which forms part of the code is deprecated in all new versions of PHP.
I won't pretend I understand how this works! :)
Here's the existing code below - this contains the eregi() bit:
// check for any human hacking attempts
class clean {
function comments($message) {
$this->naughty = false;
$this->message = $message;
$bad = array("content-type","bcc:","to:","cc:","href");
$for = array( "\r", "\n", "%0a", "%0d");
foreach($bad as $b) {
if(eregi($b, $this->message)) {
$this->naughty = true;
}
}
$this->message = str_replace($bad,"#removed#", $this->message);
$this->message = stripslashes(str_replace($for, ' ', $this->message));
// check for HTML/Scripts
$length_was = strlen($this->message);
$this->message = strip_tags($this->message);
if(strlen($this->message) < $length_was) {
$this->naughty = true;
}
}
} // class
After Googling I'm guessing I need to replace the eregi() bit with preg_match?
I have no idea where to put this in the above code for it to work?
Does anybody have any ideas?
Thanks in advance, kind regards
Brian