send email script


#1

I have a script that has been working fine, but I have moved the site to a new host and now the email send script does not work. It sends the email but the parameters are no longer passed from my html form.

I have been looking at the script to try and understand why.

one line reads :

if(!eregi(‘yorkshireinn.com’,$host[Referer])){

I am not sure exact what the $host… does??

PHP is working fine on the new host, so theoretically the script should also work as normal.

any pointers?
thanks


#2

Post the entire code.


#3

Where is the $host[referer] set, and what is it set to?


#4

Here is the script below the lines building the HTML message.

$host=apache_request_headers();
if(!eregi(‘yorkshireinn.com’,$host[Referer])){
?>

<? } else{ if(ereg(",",$email)|| ereg(";",$email)){ ?> <? } else{ $headers = "From: $emailn"; $headers.= "Bcc: $ccmailn"; $headers.= "Content-Type: text/html; charset=windows-874"; #mail("$to","$subject", "$msg", "$headers"); if (mail("$to","$subject", "$msg", "$headers")) { echo header("location: ../thanks.html"); } else { echo "not"; } } }

#5

Why do you use apache_request_headers(), rather than the superglobal $_SERVER? I presume your new host runs on Apache, or else the function would have returned an error, but I’m not sure if it returns an array with index ‘referer’.


#6

Yes the new host runs Apache.
I am not sure why it uses this command. I am too new to PHP to really comment. Just trying to get a script working that work perfect on old host, also running apache. !?!


#7

Instead of using $host[Referer], try using $_SERVER[‘REFERER’].


#8

Hello, I have tried $_Server[‘Referer’] but nothing at all happens.

With $host[Referer] the email is sent but the field content is not passed.

When trying the new command on clicking Submit, the form just stays on the screen.


#9

I’d say try some Debugging and tell us what happens then. $_SERVER[‘REFERER’] should have a value unless you have browser plugins that seriously mess up the server request.