Re: Hopiing for some leads as to what may be wrong in this code [message #182253 is a reply to message #182250] |
Thu, 25 July 2013 17:37 |
bill
Messages: 310 Registered: October 2010
Karma:
|
Senior Member |
|
|
On 2013-07-24 11:42 PM, Scott Johnson wrote:
> On 7/24/2013 4:27 PM, Twayne wrote:
>> Hi all,
>>
>> I have a seemingly strange thing happening here. I have a contact form
>> on one website that works perfectly and that same form with appropriate
>> changes, results in an error message during a check of a random number
>> (created with mt_rnd() ) on the other site. Both sites are located on
>> the same remote servers.
>>
>> Win 7, PHP 5.3.5, XAMPP local server, standard Unix remote server:
>>
>> Please consider the following:
>>
>> Complete form consists of three .PHP pages; no HTML. Entry form, check
>> page, mailto() page; pretty standard stuff in that way:
>>
>> ================
>> WORKING CODE ON REMOTE SERVER:
>>
>> Setting the code on landing page:
>> $_SESSION["d"] = $d;
>> --------------------
>>
>> $code= $_POST["code"];
>> if($_SESSION["d"] !== $code) {
>> echo "<br />You did not enter the correct code: Script halted, ALL
>> data destroyed.<br /> you'll have to go back to the website and start
>> over.<br />";
>> die("Script HALTED, data destroyed");
>> session_destroy();
>> exit();
>> }
>> RESULT:
>> page throws no error either with local or remote server: Message is sent
>> successfully.
>>
>> ===============================
>>
>> NON-WORKING CODE ON REMOTE SERVER BUT WORKS ON LOCAL HOST:
>>
>> Setting the code on previous page:
>> $_SESSION["d"] = $d;
>> ----------------------
>> Page with problem:
>> $code= $_POST["code"];
>> if($_SESSION["d"] !== $code) {
>> echo "<br />You did not enter the correct code: Script halted, ALL
>> data destroyed.<br /> you'll have to go back to the website and start
>> over.<br />";
>> die("Script HALTED, data destroyed");
>> session_destroy();
>> exit();
>> }
>>
>> RESULT:
>> [Gets stuck on the second page of the form where PHP sanitize/validation
>> happens; never makes it to last page with the mail() function]:
>>
>> using code : 487-535175 <----------- WHICH IS CORRECT CODE
>> You did not enter the correct code: Script halted, ALL data destroyed.
>> you'll have to go back to the website and start over.
>> Script HALTED, data destroyed
>> ================
>>
>> Can you spot any differences there? The local server throws NO error,
>> notices or warnings. But the Remote Server stops cold on the second
>> page, indicating the code is wrong. But it's not; I can see the code;
>> it's correct. But it seems to never be seen as correct by my Remote
>> Server while my Local Server accepts it perfectly.
>>
>> What really gets me is it works on one site and not the one I'm trying
>> to perpetuate the code to. OH, and both sites are on the same Remote
>> Servers at Netfirms.com. Separate accounts of course.
>> I'm not using rewrites, no php changes on the Remote Server; both
>> sites are on the same server.
>> Any thoughts or ideas what I might be doing wrong or where else I
>> should be looking?
>>
>> TIA,
>>
>> twayne`
>
> What is the error message as well?
> What specific behavior where you expecting that you are not getting?
There is no Server message; the error is my own code taking the "bad
code" path and halting the script, so it's my own code that's the
problem, OE something different at the Server. I just did a PHPinfo()
comparison to my local server and they're darned near identical, so why
it succeeds in the other script and not in this current script on a
different sit on the SAME server is beyond me!
Yesterday I ported the complete, untouched code from the working
site to the problem site, and got the same identical problem of the
script halting due to taking the wrong fork in the IF statement! I'm at
a complete loss. Guess I'll have to go thru it more and look for copy
problems et al.
I'm no guru with PHP but this still has me real confused.
The reason I don't post complete codes are, I'm not allowed to for
security reasons. Changing them around to be able to post them would
destroy their integrity for posting here due to the stuff I'd have to do
to be able to post it in the clear. It's also a LOT of code; every page!
Any thoughts, comments are still welcome.
Regards,
Twayne`
|
|
|