PDA

View Full Version : php form "action" can't find page on secure server



SueD
09-05-2003, 08:11 AM
I'm having two problems with my custom php shopping cart. First a form action to get a page on the secure server was:

action="https://secure.westhost.net/domainName/shopping/confirmit.php"

my new secure server address should be: https://ssl4.westserver.net/domainName/shopping/confirmit.php

But I get an error message saying it can't access ssl4.westserver.net. Does anyone know if I'm supposed to format the address differently? Am I supposed to set something up that I don't know about? If I go to https://ssl4.westserver.net/domainName/ the homepage comes up, so I know the SSL is setup OK.

Second question: The confirmit.php file goes to order.php which creates a txt file based on the php array from the cusomer's info. This txt file is put in an "orders" folder and an email is sent letting me know an order has been received. The code I have used to generate the file is:

$fn = strftime("/home/domainName/orders/order-%Y-%m-%d-%H-%M-%S.txt");

but now the website is in var/www/html/. Can anyone tell me how to change what I had? I've tried some variations of the new address, but it doesn't work. I can't figure out how to set this up.

Finally, the code to send the email was:

mail("sales@domainName", "A web order was placed by " . $_REQUEST['realname'],
"A new web order can be found in $fn" );

Will this still work? Because of the previous issue (no file was saved because the directory didn't exist), no emails have been received, even though the website shopping cart would go to the follow-up page and say the order had been received.

I'm new to php and appreciate any help you can offer.

SueD

gbanse
09-05-2003, 08:25 AM
Hello Sue,
With regards to https://ssl4.westserver.net - if it works for the root it should work for all. Do you have any references to the old URL in your code? That'd be the first thing I'd check.

With regards to the path - drop a phpinfo file into that dir and then find the path information at the entry for DOCUMENT_ROOT. That will give the webserver path to the document.

With regards to the emailer - it should work once the above issues are dealt with successfully.

SueD
09-05-2003, 10:09 AM
gbanse,

Well, I'm getting closer. I did phpinfo and got the pathname, got as far as the order.php (the one trying to write the txt file and email me) which gives these errors:

Warning: fopen(/ssl/domainName/orders/order-2003-09-05-09-53-32.txt) [function.fopen]: failed to create stream: Permission denied in /master2/wdclnx10/home/accounts/domainName/var/www/html/shopping/order08.php on line 19

and

Warning: fputs(): supplied argument is not a valid stream resource in /master2/wdclnx10/home/accounts/domainName/var/www/html/shopping/order08.php on line 21

Any idea why permission is denied in first error? If I get permission, do you think I'll need to change whatever error 2 is about?

The email was sent successfully, but there was not file to be found.

I feel clueless; thanks for your help.

SueD

gbanse
09-05-2003, 10:25 AM
Sue,
Ok, let's take them one at a time.

That fopen error means the script can't find the file or the permissions on the file are such that it can't open it. Check to see if the file exists. If it does, check the path (which is what I suspect), and if you're confident about the path - check the file's permissions. Note what the current setting is and then set it to 777 for testing purposes and try again.

SueD
09-06-2003, 07:55 AM
Problem is solved; here's what I learned:

/ssl/domainName/folder/file is the address I need to get to a file on the secure server (the current page is already on it).

the fopen error occured because php on the secure server does not recognize short tags. So <? had to be changed to <?php and <?= had to be changed to <?php echo . Once that was done, all was back to normal.

Hope this helps anyone with the same problem.

SueD

gbanse
09-06-2003, 09:05 AM
Hello SueD,
Thanks for the follow up. I'm glad the problem has been resolved.