Forum Moderators: coopster
Thanks
$url = strtolower($HTTP_HOST);
$url = ereg_replace("www.", "", $url);
if (!ereg($url,$HTTP_REFERER)) DIE ("<html><script language='JavaScript'>alert('Security Violation: Unauthorized referer!'),history.go(-1)</script></html>");
if (($recipient=="") ¦¦ (!ereg("[A-Za-z0-9_-]+([\.]{1}[A-Za-z0-9_-]+)*@[A-Za-z0-9-]+([\.]{1}[A-Za-z0-9-]+)+", $recipient)) ¦¦ (strlen($recipient)>100)) DIE ("<html><script language='JavaScript'>alert('Sorry, this form cannot be submitted!\\\n\\\nReason: Invalid recipient field!\\\n\\\nPlease contact the webmaster for details.'),history.go(-1)</script></html>");
if (($email!="") && (!ereg("[A-Za-z0-9_-]+([\.]{1}[A-Za-z0-9_-]+)*@[A-Za-z0-9-]+([\.]{1}[A-Za-z0-9-]+)+", $email))) DIE ("<html><script language='JavaScript'>alert('Please enter your e-mail address! A valid e-mail address must be in you@yourname.com format.'),history.go(-1)</script></html>");
// trimmed other processing code here - jatar_k
[edited by: jatar_k at 5:51 pm (utc) on Feb. 10, 2004]
[edit reason] reduced to relevant code [/edit]
Referers aren't always passed by the browser so it could just be that issue if it isn't always happening. What percentage of your users are having the issue?
You could remove the referer check if the majority of them can't submit it. Then you could just add more checks on the actual fields.
The problem is more than likely with your $HTTP_REFERER variable. You may want to read this thread that asks Where is $HTTP_REFERER? [webmasterworld.com]
<edit>good morning, jatar_k! beat me to this one...</edit> :)