Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #10199 > unrolled thread

Hopiing for some leads as to what may be wrong in this code

Started byTwayne <nobody@spamcop.net>
First post2013-07-24 19:27 -0400
Last post2013-07-27 11:05 -0400
Articles 20 — 8 participants

Back to article view | Back to comp.lang.php


Contents

  Hopiing for some leads as to what may be wrong in this code Twayne <nobody@spamcop.net> - 2013-07-24 19:27 -0400
    Re: Hopiing for some leads as to what may be wrong in this code Jerry Stuckle <jstucklex@attglobal.net> - 2013-07-24 23:04 -0400
      Re: Hopiing for some leads as to what may be wrong in this code Twayne <nobody@spamcop.net> - 2013-07-25 13:39 -0400
      Re: Hopiing for some leads as to what may be wrong in this code Twayne <nobody@spamcop.net> - 2013-08-04 16:24 -0400
        Re: Hopiing for some leads as to what may be wrong in this code Jerry Stuckle <jstucklex@attglobal.net> - 2013-08-04 22:08 -0400
    Re: Hopiing for some leads as to what may be wrong in this code Scott Johnson <noonehome@chalupasworld.com> - 2013-07-24 20:42 -0700
      Re: Hopiing for some leads as to what may be wrong in this code Twayne <nobody@spamcop.net> - 2013-07-25 13:37 -0400
    Re: Hopiing for some leads as to what may be wrong in this code The Natural Philosopher <tnp@invalid.invalid> - 2013-07-25 09:28 +0100
      Re: Hopiing for some leads as to what may be wrong in this code Twayne <nobody@spamcop.net> - 2013-07-25 13:24 -0400
        Re: Hopiing for some leads as to what may be wrong in this code The Natural Philosopher <tnp@invalid.invalid> - 2013-07-25 19:18 +0100
    Re: Hopiing for some leads as to what may be wrong in this code Christoph Michael Becker <cmbecker69@arcor.de> - 2013-07-25 19:51 +0200
      Re: Hopiing for some leads as to what may be wrong in this code Twayne <nobody@spamcop.net> - 2013-07-25 14:11 -0400
        Re: Hopiing for some leads as to what may be wrong in this code Christoph Michael Becker <cmbecker69@arcor.de> - 2013-07-25 20:31 +0200
        Re: Hopiing for some leads as to what may be wrong in this code Norman Peelman <npeelman@cfl.rr.com> - 2013-07-25 20:37 -0400
          Re: Hopiing for some leads as to what may be wrong in this code Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-07-27 12:17 +0200
            Re: Hopiing for some leads as to what may be wrong in this code Fiver <numeralfive@gmail.com> - 2013-07-28 07:01 +0200
              Re: Hopiing for some leads as to what may be wrong in this code Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-07-28 17:48 +0200
                Re: Hopiing for some leads as to what may be wrong in this code The Natural Philosopher <tnp@invalid.invalid> - 2013-07-28 19:17 +0100
      Re: Hopiing for some leads as to what may be wrong in this code Twayne <nobody@spamcop.net> - 2013-07-25 14:24 -0400
    RESOLVED Re: Hopiing for some leads as to what may be wrong in this code Twayne <nobody@spamcop.net> - 2013-07-27 11:05 -0400

#10199 — Hopiing for some leads as to what may be wrong in this code

FromTwayne <nobody@spamcop.net>
Date2013-07-24 19:27 -0400
SubjectHopiing for some leads as to what may be wrong in this code
Message-ID<kspnth$vnb$1@speranza.aioe.org>
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`

[toc] | [next] | [standalone]


#10200

FromJerry Stuckle <jstucklex@attglobal.net>
Date2013-07-24 23:04 -0400
Message-ID<ksq484$utt$1@dont-email.me>
In reply to#10199
On 7/24/2013 7: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`

Without posting the entire code, any answer would be just a guess.


-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#10205

FromTwayne <nobody@spamcop.net>
Date2013-07-25 13:39 -0400
Message-ID<ksrnsq$49h$2@speranza.aioe.org>
In reply to#10200
On 2013-07-24 11:04 PM, Jerry Stuckle wrote:
<snip>
>
> Without posting the entire code, any answer would be just a guess.
>
>
See my response to Scott if you're interested in why the complete post 
isn't included.

[toc] | [prev] | [next] | [standalone]


#10398

FromTwayne <nobody@spamcop.net>
Date2013-08-04 16:24 -0400
Message-ID<ktmd97$s3j$1@speranza.aioe.org>
In reply to#10200
On 2013-07-24 11:04 PM, Jerry Stuckle wrote:
> On 7/24/2013 7: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:
>>
...

>>
>> 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`
>
> Without posting the entire code, any answer would be just a guess.
>
>
OR, as another person pointed out, you could have suggested the same 
thing he did. But you didn't.

Another post from you with no content.

[toc] | [prev] | [next] | [standalone]


#10406

FromJerry Stuckle <jstucklex@attglobal.net>
Date2013-08-04 22:08 -0400
Message-ID<ktn11n$srp$2@dont-email.me>
In reply to#10398
On 8/4/2013 4:24 PM, Twayne wrote:
> On 2013-07-24 11:04 PM, Jerry Stuckle wrote:
>> On 7/24/2013 7: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:
>>>
> ...
>
>>>
>>> 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`
>>
>> Without posting the entire code, any answer would be just a guess.
>>
>>
> OR, as another person pointed out, you could have suggested the same
> thing he did. But you didn't.
>
> Another post from you with no content.
>

Trolling again, I see.

No, I didn't suggest what someone else said, because his was just a guess.

I prefer to diagnose the problem and give a *CORRECT* answer - not play 
guessing games.


-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#10201

FromScott Johnson <noonehome@chalupasworld.com>
Date2013-07-24 20:42 -0700
Message-ID<ksq6fl$8j4$1@dont-email.me>
In reply to#10199
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?

[toc] | [prev] | [next] | [standalone]


#10204

FromTwayne <nobody@spamcop.net>
Date2013-07-25 13:37 -0400
Message-ID<ksrnnu$49h$1@speranza.aioe.org>
In reply to#10201
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`

[toc] | [prev] | [next] | [standalone]


#10202

FromThe Natural Philosopher <tnp@invalid.invalid>
Date2013-07-25 09:28 +0100
Message-ID<ksqnk7$cm8$1@news.albasani.net>
In reply to#10199
On 25/07/13 00:27, 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 #
I wonder if that's being evaluated as a numerical expression..
> 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`
When I have had similar issues running phpinfo() on both sites usually 
reveals a different php envoironment and gives a clue as to where it's 
being set as well.


-- 
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.

[toc] | [prev] | [next] | [standalone]


#10203

FromTwayne <nobody@spamcop.net>
Date2013-07-25 13:24 -0400
Message-ID<ksrn06$1rc$1@speranza.aioe.org>
In reply to#10202
On 2013-07-25 4:28 AM, The Natural Philosopher wrote:
> On 25/07/13 00:27, Twayne wrote:
>> Hi all,
...
>>
>> Win 7, PHP 5.3.5, XAMPP local server, standard Unix remote server:
>>
...
>>
>> 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 #
> I wonder if that's being evaluated as a numerical expression..
>> 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`
> When I have had similar issues running phpinfo() on both sites usually
> reveals a different php envoironment and gives a clue as to where it's
> being set as well.

I'm not very good at reading PHPinfo() but the two PHPinfo() displays 
(my local Apache server and Remote Server) are the same in all the areas 
that would seemingly have anything to do with PHP; same paths, same 
dates, same revs, etc. and in its entirety also. I purposely keep my 
local PHP version the same as my Servers.

Thanks ... I ran thru the effort again, just to be sure.

Twayne`


>
>

[toc] | [prev] | [next] | [standalone]


#10208

FromThe Natural Philosopher <tnp@invalid.invalid>
Date2013-07-25 19:18 +0100
Message-ID<ksrq61$mkk$1@news.albasani.net>
In reply to#10203
On 25/07/13 18:24, Twayne wrote:
> On 2013-07-25 4:28 AM, The Natural Philosopher wrote:
>> On 25/07/13 00:27, Twayne wrote:
>>> Hi all,
> ...
>>>
>>> Win 7, PHP 5.3.5, XAMPP local server, standard Unix remote server:
>>>
> ...
>>>
>>> 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 #
>> I wonder if that's being evaluated as a numerical expression..
>>> 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`
>> When I have had similar issues running phpinfo() on both sites usually
>> reveals a different php envoironment and gives a clue as to where it's
>> being set as well.
>
> I'm not very good at reading PHPinfo() but the two PHPinfo() displays 
> (my local Apache server and Remote Server) are the same in all the 
> areas that would seemingly have anything to do with PHP; same paths, 
> same dates, same revs, etc. and in its entirety also. I purposely keep 
> my local PHP version the same as my Servers.
>

I was thinking more of stuff like magic quotes, charsets and other minor 
things that might affect how the code was interpreted.

The other place I routinely look, because I can, is apache error logs. 
Thats where PHP errors tend to popup up if not displayed onscreen.

> Thanks ... I ran thru the effort again, just to be sure.
>
> Twayne`
>
>
>>
>>
>


-- 
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.

[toc] | [prev] | [next] | [standalone]


#10206

FromChristoph Michael Becker <cmbecker69@arcor.de>
Date2013-07-25 19:51 +0200
Message-ID<51f1653b$0$6627$9b4e6d93@newsspool2.arcor-online.net>
In reply to#10199
Twayne wrote:

>  $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();
> }

You may consider checking the actual values of $code and $_SESSION['d']
immediately before the if statement (if you don't have a debugger at
hand, just use a simple var_dump()).

BTW: calling session_destroy() after die() was executed doesn't have any
effect.  You'll want to swap both lines and remove the exit().

-- 
Christoph M. Becker

[toc] | [prev] | [next] | [standalone]


#10207

FromTwayne <nobody@spamcop.net>
Date2013-07-25 14:11 -0400
Message-ID<ksrpol$9me$1@speranza.aioe.org>
In reply to#10206
On 2013-07-25 1:51 PM, Christoph Michael Becker wrote:
> Twayne wrote:
>
>>   $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();
>> }
>
> You may consider checking the actual values of $code and $_SESSION['d']
> immediately before the if statement (if you don't have a debugger at
> hand, just use a simple var_dump()).

It's interesting, but I did.  A rev back I had an echo for "code" and 
Session(... and it prints them just before it throws the error message.
>
> BTW: calling session_destroy() after die() was executed doesn't have any
> effect.  You'll want to swap both lines and remove the exit().
>

THAT is wise advice!  Thanks I'll do just that; thanks for pointing it out.

[toc] | [prev] | [next] | [standalone]


#10210

FromChristoph Michael Becker <cmbecker69@arcor.de>
Date2013-07-25 20:31 +0200
Message-ID<51f16e72$0$6634$9b4e6d93@newsspool2.arcor-online.net>
In reply to#10207
Twayne wrote:

> On 2013-07-25 1:51 PM, Christoph Michael Becker wrote:
>> Twayne wrote:
>>
>>>   $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();
>>> }
>>
>> You may consider checking the actual values of $code and $_SESSION['d']
>> immediately before the if statement (if you don't have a debugger at
>> hand, just use a simple var_dump()).
> 
> It's interesting, but I did.  A rev back I had an echo for "code" and
> Session(... and it prints them just before it throws the error message.

And both had exactly the same value (a leading or trailing space, for
instance, make a big difference here) and the same *type*?  Then the
body of the if statement won't be executed.

[toc] | [prev] | [next] | [standalone]


#10211

FromNorman Peelman <npeelman@cfl.rr.com>
Date2013-07-25 20:37 -0400
Message-ID<kssg0b$scn$1@dont-email.me>
In reply to#10207
On 07/25/2013 02:11 PM, Twayne wrote:
> On 2013-07-25 1:51 PM, Christoph Michael Becker wrote:
>> Twayne wrote:
>>
>>>   $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();
>>> }
>>
>> You may consider checking the actual values of $code and $_SESSION['d']
>> immediately before the if statement (if you don't have a debugger at
>> hand, just use a simple var_dump()).
>
> It's interesting, but I did.  A rev back I had an echo for "code" and
> Session(... and it prints them just before it throws the error message.
>>
>> BTW: calling session_destroy() after die() was executed doesn't have any
>> effect.  You'll want to swap both lines and remove the exit().
>>
>
> THAT is wise advice!  Thanks I'll do just that; thanks for pointing it out.
>

    $code= $_POST["code"];
    echo "<pre>";
    var_dump($_SESSION["d"]);
    var_dump($code);
    echo "</pre>";
    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();


   You need to make sure that both variables are of the same *value* and 
*type*. Another way to check would be to change !== to != (or <>). The 
only way your branch gets executed is if they do not match both *value* 
and *type*.

-- 
Norman
Registered Linux user #461062
-Have you been to www.php.net yet?-

[toc] | [prev] | [next] | [standalone]


#10227

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2013-07-27 12:17 +0200
Message-ID<1549820.iUFmqMPUIr@PointedEars.de>
In reply to#10211
Norman Peelman wrote:

> On 07/25/2013 02:11 PM, Twayne wrote:
>> On 2013-07-25 1:51 PM, Christoph Michael Becker wrote:
>>> Twayne wrote:
>>>>   $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();
>>>> }
>>>
>>> You may consider checking the actual values of $code and $_SESSION['d']
>>> immediately before the if statement (if you don't have a debugger at
>>> hand, just use a simple var_dump()).
>>
>> It's interesting, but I did.  A rev back I had an echo for "code" and
>> Session(... and it prints them just before it throws the error message.
>>>
>>> BTW: calling session_destroy() after die() was executed doesn't have any
>>> effect.  You'll want to swap both lines and remove the exit().
>>>
>>
>> THAT is wise advice!  Thanks I'll do just that; thanks for pointing it
>> out.
>>
> 
>     $code= $_POST["code"];
>     echo "<pre>";
>     var_dump($_SESSION["d"]);
>     var_dump($code);
>     echo "</pre>";
>     if($_SESSION["d"] !== $code) {

      if ($_SESSION["d"] !== $code) {

(it is not a call)

>       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();
> 
> 
>    You need to make sure that both variables are of the same *value* and
> *type*. Another way to check would be to change !== to != (or <>). The
> only way your branch gets executed is if they do not match both *value*
> and *type*.

What are you getting at?  I do not see how a $_POST element could ever be 
*not* a string, and the result of “!==” can be false even when the two 
operands *are* of the same type.  And the code must be a string here (it 
contains “-”), so $_SESSION['d'] would be a string.

The difference is perhaps in the session not being started or recognized on 
one PHP host, but on the other.  If the session is not started, it could be 
that session information cannot be written to the filesystem; if the session 
is not recognized, it could be that the session cookie is not set on the 
client-side due to user settings.

ISTM there still is not enough information in the posting; for example, the 
part that *sets* $_SESSION['d'] is missing.

The OP should take heed of

<http://www.catb.org/~esr/faqs/smart-questions.html>

and stop wasting everybody's time with guessing games.


PointedEars
-- 
Sometimes, what you learn is wrong. If those wrong ideas are close to the 
root of the knowledge tree you build on a particular subject, pruning the 
bad branches can sometimes cause the whole tree to collapse.
  -- Mike Duffy in cljs, <news:Xns9FB6521286DB8invalidcom@94.75.214.39>

[toc] | [prev] | [next] | [standalone]


#10268

FromFiver <numeralfive@gmail.com>
Date2013-07-28 07:01 +0200
Message-ID<kt2879$31v$1@dont-email.me>
In reply to#10227
On 2013-07-27 12:17, Thomas 'PointedEars' Lahn wrote:
> I do not see how a $_POST element could ever be *not* a string

<input name="foo[]" value="bar">

regards,
5er

[toc] | [prev] | [next] | [standalone]


#10279

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2013-07-28 17:48 +0200
Message-ID<3749815.ZI9asfGdyp@PointedEars.de>
In reply to#10268
Fiver wrote:

> On 2013-07-27 12:17, Thomas 'PointedEars' Lahn wrote:
>> I do not see how a $_POST element could ever be *not* a string
> 
> <input name="foo[]" value="bar">

True, I forgot about that.  But in this case you would not use a simple 
comparison.


PointedEars
-- 
> If you get a bunch of authors […] that state the same "best practices"
> in any programming language, then you can bet who is wrong or right...
Not with javascript. Nonsense propagates like wildfire in this field.
  -- Richard Cornford, comp.lang.javascript, 2011-11-14

[toc] | [prev] | [next] | [standalone]


#10286

FromThe Natural Philosopher <tnp@invalid.invalid>
Date2013-07-28 19:17 +0100
Message-ID<kt3n78$eoq$2@news.albasani.net>
In reply to#10279
On 28/07/13 16:48, Thomas 'PointedEars' Lahn wrote:

If you get a bunch of authors […] that state the same "best practices"
in any programming language, then you can bet who is wrong or right...

Not with javascript. Nonsense propagates like wildfire in this field.
   -- Richard Cornford, comp.lang.javascript, 2011-11-14


I think javascript is probably the ugliest language I have ever had to 
program in really. Even worse than PHP.

By trying to make it 'easy for stupes' they make it very hard for people 
who understand exactly what they want it to do, by hiding the means by 
which it is to be done.

-- 
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.

[toc] | [prev] | [next] | [standalone]


#10209

FromTwayne <nobody@spamcop.net>
Date2013-07-25 14:24 -0400
Message-ID<ksrqgc$bh1$1@speranza.aioe.org>
In reply to#10206
On 2013-07-25 1:51 PM, Christoph Michael Becker wrote:
> Twayne wrote:
>
>>   $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();
>> }
>
> You may consider checking the actual values of $code and $_SESSION['d']
> immediately before the if statement (if you don't have a debugger at
> hand, just use a simple var_dump()).
>
> BTW: calling session_destroy() after die() was executed doesn't have any
> effect.  You'll want to swap both lines and remove the exit().
>

HUH! You seem to have driven something home!  I fixed up the changes you 
recommended, tried it, and drew a 500 Error from the server. Put it back 
the way it was and still getting a 500 error. It's not definitive, but 
it suggest something went seriously wrong.
    Thanks for even that much,

Twayne`

[toc] | [prev] | [next] | [standalone]


#10232 — RESOLVED Re: Hopiing for some leads as to what may be wrong in this code

FromTwayne <nobody@spamcop.net>
Date2013-07-27 11:05 -0400
SubjectRESOLVED Re: Hopiing for some leads as to what may be wrong in this code
Message-ID<kt0nkb$eof$1@speranza.aioe.org>
In reply to#10199
GOT IT!  Finally.

Turns out my php.ini for my remote site was damaged.  I've been running 
around the pole for a week or more with them, getting various answers, 
including it was my own fault and they won't help people with coding. 
Jeezum Crow!
    Everything was pointing to my server host, and not me, so: Today I 
got fed up enough to try a chat, and a phone call if that didn't help.
    Just goes to show: The chat tech asked me to hold while he checked 
my accounts and a few seconds later was back, problem solved!!  I 
learned long ago to not give Support departments a chance to push things 
back on me and just keep trying until you get the right tech or 
supervisor or whatever. How one guy could look at whatever he looked at 
and fix it right away and the others couldn't, well, speaks volumes 
about support departments.

Thanks for all the excellent responses and attempts to assist. This is a 
great ng!

Best Regards,

Twayne`




On 2013-07-24 7: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`

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web