Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
May 25, 2012, 10:44:05 AM

Pages: [1] 2   Go Down
  Print  
Author Topic: Form mail bugs  (Read 774 times)
ShockQueen
Spaceship Navigator
*****
Offline Offline

Posts: 97


WWW
« on: April 17, 2002, 03:50:00 PM »

I'm not quite sure where I'm going wrong here, so I'm hoping someone can check my code to see what the deal is  

I'm putting together an order page, which currently is sitting at:
http://www.raveswear.cc/orderpage.html

Once it's set, then I hope to have the fine staff move it to an SSL-encrypted page for safe ordering.

I'm just not sure where my code is wrong at.....

Thanks in advance!

SQ
Logged

I keep clicking my ruby slippers, but the teleportation crystal inside must be broken!
TWebMan
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3112



WWW
« Reply #1 on: April 20, 2002, 03:32:00 AM »

You're setting up a secure order form, it seems.
You probably wouldn't want it to send an email, unless you set up a whole encryption key on your email client, and match the key on the server.  Your best bet is to have it write to a log file on the secure server, and you can download and delete that log file at regular intervals.

I went and submitted and it seemed fine, but I didn't put anything in the fields.  Are you getting an error when you fill out fields?

There are some cart programs available for free, both in perl and php.  If you want to look at some, let me know and I'll post some links.

[ April 20, 2002: Message edited by: TWebMan ]

Logged

"Computers cause people to make more mistakes than any other invention in history, with the possible exception of handguns and tequila."  - Unknown
"Liberty of any kind is seldom lost all at once." - D. Hume
Every day is an Ode to Joy
The planet will be fine... and so will your site
ShockQueen
Spaceship Navigator
*****
Offline Offline

Posts: 97


WWW
« Reply #2 on: April 20, 2002, 08:56:00 AM »

The problem is that, while it sends out OK, the E-mail that comes in is totally blank - even when I fill out the information.

I'm waiting for the ASP to be activated on the server once Max moves everything over to the new environment, and I'm still trying to figure out some of the stuff on the Agora cart since the Interchange one didn't work out at all.

Basically, once the form is working OK, I'm sending it to Max to put on an SSL-encrypted server so that way it will not be at risk.  I just need to get it to where it will send the information from the form in the body of the E-mail.

It's a work in progress.....what can ya say?  

SQ  
Logged

I keep clicking my ruby slippers, but the teleportation crystal inside must be broken!
TWebMan
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3112



WWW
« Reply #3 on: April 20, 2002, 02:55:00 PM »

Try the custom perl script page I have up.  It only accepts 8 fields (I think), but it's a simple script and you can see where the fields get written into the mail message.  You can make one, then customize it to match your form.  It'll work.  You can do it Here.
Logged

"Computers cause people to make more mistakes than any other invention in history, with the possible exception of handguns and tequila."  - Unknown
"Liberty of any kind is seldom lost all at once." - D. Hume
Every day is an Ode to Joy
The planet will be fine... and so will your site
ShockQueen
Spaceship Navigator
*****
Offline Offline

Posts: 97


WWW
« Reply #4 on: April 20, 2002, 04:06:00 PM »

Thank you SO MUCH TWebman!!!  

I shall work on this script and let you know when it's finished!      

SQ  
Logged

I keep clicking my ruby slippers, but the teleportation crystal inside must be broken!
ShockQueen
Spaceship Navigator
*****
Offline Offline

Posts: 97


WWW
« Reply #5 on: April 21, 2002, 06:05:00 AM »

Okay...here is what I came up with.  I'll try uploading this to my cgi-bin tonight and pray that it works OK.  I keyed it to the items that are on my online ordering page (http://www.raveswear.cc/orderpage.html), so please tell me that I did it right.  Here goes:

This was modified from the page you sent me....

# BEGINNING OF PERL SCRIPT --------------------------------------------------------------
#!/usr/bin/perl
if ($ENV{'REQUEST_METHOD'} eq 'GET')
{ @pairs = split(/&/, $ENV{'QUERY_STRING'}) }
elsif ($ENV{'REQUEST_METHOD'} eq 'POST'){
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);}
local($name, $value);
foreach $pair (@pairs){
($name, $value) = split(/=/, $pair);
$name =~ tr/+/ /;
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s///g;
$gForm{$name} = $value;}

# You can safely delete any lines below here that say -- print MAIL ": $gForm{''}\n";
open(MAIL, "|/usr/lib/sendmail -t");
print MAIL "To: orders\@raveswear.cc\n";
print MAIL "From: $gForm{'Email'}\n";
print MAIL "Subject: My Rave's Order\n";
print MAIL "--------------------------------------------------------\n";
print MAIL "Name: $gForm{'Name'}\n";
print MAIL "Street: $gForm{'Street'}\n";
print MAIL "Apt#: $gForm{'Apt#'}\n";
print MAIL "City: $gForm{'City'}\n";
print MAIL "State: $gForm{'State'}\n";
print MAIL "BillingZip: $gForm{'BillingZip'}\n";
print MAIL "BillingCountry: $gform{'BillingCountry'}\n;
print MAIL "Item #1: $gForm{'Item1'}\n";
print MAIL "Size #1: $gForm{'Size1'}\n";
print MAIL "Description #1: $gForm{'Description1'}\n";
print MAIL "Color #1: $gForm{'Color1'}\n";
print MAIL "Price #1: $gForm{'Price1'}\n";
print MAIL "Quantity #1: $gForm{'Quantity1'}\n";
print MAIL "Subtotal #1: $gForm{'Subtotal1'}\n";
print MAIL "Item #2: $gForm{'Item2'}\n";
print MAIL "Size #2: $gForm{'Size2'}\n";
print MAIL "Description #2: $gForm{'Description2'}\n";
print MAIL "Color #2: $gForm{'Color2'}\n";
print MAIL "Price #2: $gForm{'Price2'}\n";
print MAIL "Quantity #2: $gForm{'Quantity2'}\n";
print MAIL "Subtotal #2: $gForm{'Subtotal2'}\n";
print MAIL "Item #3: $gForm{'Item3'}\n";
print MAIL "Size #3: $gForm{'Size3'}\n";
print MAIL "Description #3: $gForm{'Description3'}\n";
print MAIL "Color #3: $gForm{'Color3'}\n";
print MAIL "Price #3: $gForm{'Price3'}\n";
print MAIL "Quantity #3: $gForm{'Quantity3'}\n";
print MAIL "Subtotal #3: $gForm{'Subtotal3'}\n";
print MAIL "Item #4: $gForm{'Item4'}\n";
print MAIL "Size #4: $gForm{'Size4'}\n";
print MAIL "Description #4: $gForm{'Description4'}\n";
print MAIL "Color #4: $gForm{'Color4'}\n";
print MAIL "Price #4: $gForm{'Price4'}\n";
print MAIL "Quantity #4: $gForm{'Quantity4'}\n";
print MAIL "Subtotal #4: $gForm{'Subtotal4'}\n";
print MAIL "Item #5: $gForm{'Item5'}\n";
print MAIL "Size #5: $gForm{'Size5'}\n";
print MAIL "Description #5: $gForm{'Description5'}\n";
print MAIL "Color #5: $gForm{'Color5'}\n";
print MAIL "Price #5: $gForm{'Price5'}\n";
print MAIL "Quantity #5: $gForm{'Quantity5'}\n";
print MAIL "Subtotal #5: $gForm{'Subtotal5'}\n";
print MAIL "Item #6: $gForm{'Item6'}\n";
print MAIL "Size #6: $gForm{'Size6'}\n";
print MAIL "Description #6: $gForm{'Description6'}\n";
print MAIL "Color #6: $gForm{'Color6'}\n";
print MAIL "Price #6: $gForm{'Price6'}\n";
print MAIL "Quantity #6: $gForm{'Quantity6'}\n";
print MAIL "Subtotal #6: $gForm{'Subtotal6'}\n";
print MAIL "Item #7: $gForm{'Item7'}\n";
print MAIL "Size #7: $gForm{'Size7'}\n";
print MAIL "Description #7: $gForm{'Description7'}\n";
print MAIL "Color #7: $gForm{'Color7'}\n";
print MAIL "Price #7: $gForm{'Price7'}\n";
print MAIL "Quantity #7: $gForm{'Quantity7'}\n";
print MAIL "Subtotal #7: $gForm{'Subtotal7'}\n";
print MAIL "Item #8: $gForm{'Item8'}\n";
print MAIL "Size #8: $gForm{'Size8'}\n";
print MAIL "Description #8: $gForm{'Description8'}\n";
print MAIL "Color #8: $gForm{'Color8'}\n";
print MAIL "Price #8: $gForm{'Price8'}\n";
print MAIL "Quantity #8: $gForm{'Quantity8'}\n";
print MAIL "Subtotal #8: $gForm{'Subtotal8'}\n";
print MAIL "Item #9: $gForm{'Item9'}\n";
print MAIL "Size #9: $gForm{'Size9'}\n";
print MAIL "Description #9: $gForm{'Description9'}\n";
print MAIL "Color #9: $gForm{'Color9'}\n";
print MAIL "Price #9: $gForm{'Price9'}\n";
print MAIL "Quantity #9: $gForm{'Quantity9'}\n";
print MAIL "Subtotal #9: $gForm{'Subtotal9'}\n";
print MAIL "Item #10: $gForm{'Item10'}\n";
print MAIL "Size #10: $gForm{'Size10'}\n";
print MAIL "Description #10: $gForm{'Description10'}\n";
print MAIL "Color #10: $gForm{'Color10'}\n";
print MAIL "Price #10: $gForm{'Price10'}\n";
print MAIL "Quantity #10: $gForm{'Quantity10'}\n";
print MAIL "Subtotal #10: $gForm{'Subtotal10'}\n";
print MAIL "Total Amount Due: $gForm{'TotalAmountDue'}\n";
print MAIL "Credit Card Type: $gForm{'CreditCardType'}\n";
print MAIL "Credit Card Number: $gForm{'CreditCardNumber'}\n";
print MAIL "Expiration Date: $gForm{'ExpirationDate'}\n";
print MAIL "Messages: $gForm{'Messages'}\n";
close (MAIL);

print "location: http://www.raveswear.cc/thankyou.html\n\n";
#End OF PERL SCRIPT

Oh..please please please tell me this will work  

'Tis my first attempt at writing scripts    :whip  

Thanks!

SQ  
Logged

I keep clicking my ruby slippers, but the teleportation crystal inside must be broken!
TWebMan
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3112



WWW
« Reply #6 on: April 21, 2002, 07:42:00 AM »

If you get an error, take the hashmarks out of the print lines in the mail message.  But try it with them first.  Or, if you get an error, you can try putting forward slashes / in front of the hashmarks.  But try it just like it is first.
Umm one other suggestion.  I would never have a form online with a field called "CreditCard....anything"  ...secure, or not.  Just a suggestion.  Good luck!

     

[ April 21, 2002: Message edited by: TWebMan ]

Logged

"Computers cause people to make more mistakes than any other invention in history, with the possible exception of handguns and tequila."  - Unknown
"Liberty of any kind is seldom lost all at once." - D. Hume
Every day is an Ode to Joy
The planet will be fine... and so will your site
ShockQueen
Spaceship Navigator
*****
Offline Offline

Posts: 97


WWW
« Reply #7 on: April 21, 2002, 07:55:00 AM »

Y'know...you're right!  I'll change that field before saving the Perl file!

I'll let you know how the form works out!

SQ  
Logged

I keep clicking my ruby slippers, but the teleportation crystal inside must be broken!
ShockQueen
Spaceship Navigator
*****
Offline Offline

Posts: 97


WWW
« Reply #8 on: April 21, 2002, 03:28:00 PM »

I set the CHMOD to 755 as per the instructions and filled out the page.  After I hit submit, I received an error 500 (internal server error).

I'm not sure what you mean in your instructions by removing the 'hash marks' (I know....I should know what this means, right? )  Can you please elaborate by modifying this example for me?

print MAIL "Name: $gForm{'Name'}\n";

Much appreciated!  I think I'm getting closer now than I have been before.

SQ  
Logged

I keep clicking my ruby slippers, but the teleportation crystal inside must be broken!
TWebMan
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3112



WWW
« Reply #9 on: April 22, 2002, 03:27:00 AM »

Check your email for orders        Please post here when you got it so that I can take it down.

[ April 22, 2002: Message edited by: TWebMan ]

Logged

"Computers cause people to make more mistakes than any other invention in history, with the possible exception of handguns and tequila."  - Unknown
"Liberty of any kind is seldom lost all at once." - D. Hume
Every day is an Ode to Joy
The planet will be fine... and so will your site
ShockQueen
Spaceship Navigator
*****
Offline Offline

Posts: 97


WWW
« Reply #10 on: April 22, 2002, 04:58:00 PM »

THANK YOU THANK YOU THANK YOU TWebman!!!!!!    

I checked the E-mail and it came through perfectly!!!!

I did grab the zip file and sent it home as I'm at work right now, but thank you many times over!

What was it that you changed that got it working?  Please let me know so I can keep that information handy when I do other pages in the future.

SQ  
Logged

I keep clicking my ruby slippers, but the teleportation crystal inside must be broken!
TWebMan
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3112



WWW
« Reply #11 on: April 22, 2002, 06:35:00 AM »

The error came from:
print MAIL "BillingZip: $gForm{'BillingZip'}\n";
print MAIL "BillingCountry: $gform{'BillingCountry'}\n; <-- Notice no double quote.

After that got fixed, I figured I'd make the email a little more user friendly for you.
Enjoy!
Logged

"Computers cause people to make more mistakes than any other invention in history, with the possible exception of handguns and tequila."  - Unknown
"Liberty of any kind is seldom lost all at once." - D. Hume
Every day is an Ode to Joy
The planet will be fine... and so will your site
ShockQueen
Spaceship Navigator
*****
Offline Offline

Posts: 97


WWW
« Reply #12 on: April 22, 2002, 03:09:00 PM »

EESH!  I don't think this web server likes me or something!

I uploaded the perl file and the HTML file, ran through it after setting the permissions to 755 (like on the tutorial page you provided) and I still get server errors.

Is setting the CHMOD different than setting the permissions on the file?

Thanks much!

SQ  
Logged

I keep clicking my ruby slippers, but the teleportation crystal inside must be broken!
TWebMan
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3112



WWW
« Reply #13 on: April 22, 2002, 11:20:00 PM »

Is it in your cgi-bin?  If it's in there, and you have a pay account, go back and re-upload it without touching it and try it again
Logged

"Computers cause people to make more mistakes than any other invention in history, with the possible exception of handguns and tequila."  - Unknown
"Liberty of any kind is seldom lost all at once." - D. Hume
Every day is an Ode to Joy
The planet will be fine... and so will your site
ShockQueen
Spaceship Navigator
*****
Offline Offline

Posts: 97


WWW
« Reply #14 on: April 23, 2002, 02:52:00 AM »

Yes...it is a paid premium account, so there should be no problems with the cgi-bin.

I re-extracted the original ones you sent from the zip file, uploaded the .htm file to the public_html folder and the .pl script file to the public_html/cgi-bin, didn't touch ANYthing except renaming the .htm file to .html and this was the response I received when I pressed 'submit':

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@raveswear.cc and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.


Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


--------------------------------------------------------------------------------

Apache/1.3.23 Server at www.raveswear.cc Port 80

The same thing happened even on the original .htm file just to be sure I didn't screw anything up.  I'm wondering if there isn't some sort of server error on the site side or something if the same files worked fine on your site.

SQ      

[ April 23, 2002: Message edited by: ShockQueen ]

[ April 23, 2002: Message edited by: ShockQueen ]

Logged

I keep clicking my ruby slippers, but the teleportation crystal inside must be broken!
Pages: [1] 2   Go Up
  Print  
 
Jump to: