kpw81
03-25-2008, 07:52 PM
i'm using the following php function (which i think i was given on these forums a while ago) to try and filter an e-mail form's content to prevent unwanted code (and spamming etc)
function checkOK($field)
{
if (eregi("\r",$field) || eregi("\n",$field)){
die("An error occured sending your message from this page. Please try again later.");
}
}
but this code is so strict in what it does, it will not allow any messages to be sent via e-mail if the visitor to my site has pressed the return key in the middle of their message. how can i allow the user to use the return key but still prevent unwanted code being used?
thanks for you help
karl
function checkOK($field)
{
if (eregi("\r",$field) || eregi("\n",$field)){
die("An error occured sending your message from this page. Please try again later.");
}
}
but this code is so strict in what it does, it will not allow any messages to be sent via e-mail if the visitor to my site has pressed the return key in the middle of their message. how can i allow the user to use the return key but still prevent unwanted code being used?
thanks for you help
karl