Forum Moderators: coopster
I seem to have a problem with my contact form after a coder did some work. It is hapopening on all my form2mail forms that I use.
If anyone could help I would be ecstatic!
This is the error message-
Warning: file_get_contents(blockip.txt) [function.file-get-contents]: failed to open stream: No such file or directory in /home/jasg/public_html/form2mail.php on line 50
Warning: Cannot modify header information - headers already sent by (output started at /home/jasg/public_html/form2mail.php:50) in /home/jasg/public_html/form2mail.php on line 136
The error on line 136 means that the script has already produced some output, so you can't modify the headers because the headers have already been sent to the user. If there is HTML code above this line, or if an echo statement has been executed, you can't modify the response headers. Even an innocent blank line in your script can cause this, so you have to craft your script with care to use the header() function.
Now I get a 404 but it gets redirected to my home page...I dont get the header stuff.
What is the value of $redirectURL, or . . . . is there a value there at all?
else { header("Location: ".$redirectURL); }
If there is no value here, as in, header("Location: "), my guess is that it's going to send to the domain root, your home page (untested, but sure sounds like it.)
Headers are bits of information sent to the browser to inform it of what kind of data is being delivered. You can see these if you install the "Live HTTP Headers" extension in FireFox. When you request a regular page, it (generally) sends two headers: content-type: text/html and a status header, 200 OK. You never actually "see" these, but they are vital information digested by the browser so it knows how to handle the content.
Another example, header("content-type:application/pdf") tells the browser to open the helper app, the PDF plug in.
There are many http headers (Google it); the Location header is basically a redirect header. So header("Location:some-page.html"); will immediately exit the script at that point and direct the browser to some-page.html. Without a value, my guess is domain root, home page.
I've never tested this, never actually even thought about it, but I would bet that is what's happening there, no value in "$redirectURL." echo it out somewhere to see.