Good morning dangerous!
Actually, that code is to look for url's in comments.
To check all, you need to loop through the POST array like so:
PHP Code:
while (list($varname,$value) = each($_POST)) {
if (ereg('[http\\:\\/\\/]*[www\\.]*[A-Za-z0-9_-]+\\.[A-Za-z0-9]+', $value)) {
header("Location: error.php");
exit;
}
}
To check for ANY html, the easiest is to strip it out and compare sizes before and after.
PHP Code:
while (list($varname,$value) = each($_POST)) {
$aftervalue=strip_tags($value);
if (strlen($aftervalue)!=strlen($value)) {
echo "$varname has code in it";
header("Location: error.php");
exit;
}
}
PHP: strip_tags - Manual
Hope that helps.