server won't read PHP checkout file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

monkeynme
Forum Commoner
Posts: 28
Joined: Thu Aug 14, 2003 3:18 pm
Location: Colorado Springs, CO

server won't read PHP checkout file

Post by monkeynme »

I downloaded a Javascript Shopping Cart from NOP Design and implemented my own test shopping cart at http://www.photostencil.com/shopping/e-bladeorder.htm.

When you reach the checkout.htm page, you fill in your final personal info and upon submitting, you're to go to a Thank You page and an e-mail is sent to you confirming your order (checkout.php). But it doesn't happen. Instead, going to the checkout.php brings up the following error:
The page cannot be displayed
There is a problem with a program on the page you are trying to reach, and the page cannot be displayed.

You have attempted to execute a CGI, ISAPI, or other executable program from a directory that does not allow programs to be executed.
It doesn't appear as though there is any code requiring something other than PHP execution. And I've had no problems running other PHP scripts on this same web server. See http://www.eagleelectronicsllc.com/jobs.php

The strange thing is, when I run this same script on my TEST web server, I get the following error instead:
The form you submitted was not complete. I'm sorry, but it appears that you forgot to fill in a required field. Please go back and correct the error.
The form is completely filled out, but this error comes up anyway...again, only on the test server.

I've asked NOP Design what the problem is, but no answer. Does anyone here have an answer?
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

The error on your test server sounds like it could be a register_globals issue, ie the script requires them to be on (which it shouldn't do) but you have them Off, so i'd check that first (edit php.ini and restart apache) then see if it solves the local issue, not sure what the remote server problem.
monkeynme
Forum Commoner
Posts: 28
Joined: Thu Aug 14, 2003 3:18 pm
Location: Colorado Springs, CO

php errors

Post by monkeynme »

No, the IS department says it couldn't be the php.ini file setup. If it works for my jobs.php file, then it should work for any.

The error statement sounds as though it's trying to execute something that the server won't allow. Like maybe a CGI script or something. But I don't see any evidence of an unusal executable script within the PHP file. All I really see is the mail($b_email, $subject, $strMessageBody, $mailheaders); command and

Code: Select all

if (($b_first == "") || ($b_last == "") || ($b_addr == "") || ($b_city == "") || ($b_state == "") || ($b_zip == "") || ($b_phone == "") || ($b_email == "")) {
   doFormError("I'm sorry, but it appears that you forgot to fill in a required field.  Please go <A HREF='Javascript:history.go(-1);'>back</A> and correct the error.");
   exit;
&#125;

//# checks for valid email address
if( !(ereg("^(.+)@(.+)\\.(.+)$",$b_email)) ) &#123;
    doFormError("You submitted an invalid email address.  Please go <A HREF='Javascript:history.go(-1);'>back</A> and correct the error.");
    exit;
&#125;
[/quote]
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Right, but this is a third party script, so it might be a register_globals problem, it's easy to check, just so you can rule that out as a problem.
Looking at that bit of code you pasted then it does require them to be on, so create a simple <?php phpinfo() ?> file and make sure register_globals are On.
monkeynme
Forum Commoner
Posts: 28
Joined: Thu Aug 14, 2003 3:18 pm
Location: Colorado Springs, CO

server access gained

Post by monkeynme »

Ok, turns out that the register_globals was OFF. You can imagine the harassment I gave IS on that one. But even when it was turned on, it still didn't work. The other error I got was HTTP 403.1. I didn't mention that because IS, again, said permissions weren't an issue since my other PHP files worked. Turns out that SCRIPTS were NOT turned on for this particular website, just my others. More harassment...and now that problem is solved.

But that brings me to the next problem. Now the live site result is the same as the test site. It's telling me that I haven't filled out all of my form fields when I have. And I can't find anything in the PHP script that would cause this error. If it's possible to look at the script from the website, you can find it at http://www.photostencil.com/shopping/checkout.php

Thanks!
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

To debug, can you edit the above code so it looks like,

Code: Select all

if (($b_first == "") || ($b_last == "") || ($b_addr == "") || ($b_city == "") || ($b_state == "") || ($b_zip == "") || ($b_phone == "") || ($b_email == "")) {
   var_dump($_POST);
   doFormError("I'm sorry, but it appears that you forgot to fill in a required field.  Please go <A HREF='Javascript:history.go(-1);'>back</A> and correct the error.");
   exit;
}
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Post by Pyrite »

Sounds like the web server is IIS and you need to give the hostname_IUSR read/execute access to the directory that your php script is in where it is ging that error.
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Post by Pyrite »

Or may be just give chmod +x (execute) to the /shopping/ directory using an FTP client.
monkeynme
Forum Commoner
Posts: 28
Joined: Thu Aug 14, 2003 3:18 pm
Location: Colorado Springs, CO

debugging test

Post by monkeynme »

the DEBUGGING test came back with:
array(27) { ["ID_1"]=> string(0) "" ["QUANTITY_1"]=> string(1) "1" ["PRICE_1"]=> string(6) "450.00" ["NAME_1"]=> string(28) "14-inch E-Blade - Standalone" ["SHIPPING_1"]=> string(4) "0.00" ["ADDTLINFO_1"]=> string(0) "" ["b_first"]=> string(1) "d" ["b_last"]=> string(1) "d" ["b_addr"]=> string(1) "d" ["b_addr2"]=> string(0) "" ["b_city"]=> string(1) "d" ["b_state"]=> string(1) "d" ["b_zip"]=> string(1) "d" ["b_phone"]=> string(1) "d" ["b_fax"]=> string(0) "" ["b_email"]=> string(25) "dmaestas@photostencil.com" ["s_first"]=> string(0) "" ["s_last"]=> string(0) "" ["s_addr"]=> string(0) "" ["s_addr2"]=> string(0) "" ["s_city"]=> string(0) "" ["s_state"]=> string(0) "" ["s_zip"]=> string(0) "" ["s_phone"]=> string(0) "" ["s_fax"]=> string(0) "" ["s_email"]=> string(0) "" ["comment"]=> string(4) "test" } The form you submitted was not complete.

I'm sorry, but it appears that you forgot to fill in a required field. Please go back and correct the error.
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

That still smacks of register_globals being Off when they need to be On for the script to work.
Do you have a <?php phpinfo() ?> page on that server we can see ? Or at least check one yourself and see if they are now On, if not you need to go smack IS and get them to turn them On and restart apache.

Of course, the 'proper' way would be to fix the script so it doesn't require register_globals to be On, but you can move onto that if you want once you know it works when they are On.
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Post by Pyrite »

Well, they are running IIS as I said, not Apache.
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Post by Pyrite »

Can't you turn globals on with iniset() ?
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Ah sorry.
Still sounds like register_globals to me though *shrug*
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Can't you turn globals on with ini_set() ?
Nope, it's too late at that point. But you can use a .htaccess file

php_flag register_globals on
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Post by Pyrite »

markl999 wrote: Nope, it's too late at that point. But you can use a .htaccess file

php_flag register_globals on
But only with Apache :lol:
Post Reply