1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Buying quick $5 Paypal, help me with perl contact form!

Discussion in 'Programming' started by alex894, Dec 9, 2010.

  1. #1
    Hello,

    I'm having trouble configuring my perl form script to submit information! Form can be found here

    #!perl
    
    $body = "The following has been submitted by a customer who visited your form.";
    $subject = 'form information';
    $URL = http://www.mysiteurl.com/index.htm;
    $sendmail = "/usr/sbin/sendmail -t";
    $email = 'myemail.com';
    
    read(STDIN, $FormData, $ENV{'CONTENT_LENGTH'});
    @pairs = split(/&/, $FormData);
    foreach $pair (@pairs) {
      ($name, $value) = split(/=/, $pair);
      ($name, $value) = split(/=/, $pair);
      $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
      $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
      $value =~ s/\r//g;
      $form{$First Name} = $value;
      $form{$Last Name} =~ $value;
      $form{$Email} =~ $value;
      $form{$Confirmed Email} =~ $value;
      $form{$Postal Code} =~ $value;
    }
    
    $body .= "\n\nFirst Name: $form{'First Name'}\n\nLast Name: $form{'Last Name'}\n\nE-mail address: $form{'Email'}\n\nConfirmed E-mail address: $form{'Confirmed Email'}\n\nPostal Code: $form{'Postal Code'};
    
    open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: $!";
      print SENDMAIL "Reply-to: noreply@myemailhere.com";
      print SENDMAIL "Subject: $subject\n";
      print SENDMAIL "From: email@email.com";
      print SENDMAIL "To: $email\n";
      print SENDMAIL "Content-type: text/plain\n\n";
      print SENDMAIL $body;
    close(SENDMAIL);
    
    $foo .= "Thank you, $form{'First Name'} $form{'Last Name'}!";
    
    $error = '1' unless open (TEMPLATE,$file);
      while(<TEMPLATE>) {
        s/<!-FORM CONTENT>/$foo/sig;
        $output .= $_;
      }
    close(TEMPLATE);
    
    if ($error) {
      print "Content-type: text/html\n\n<html><body>Sorry, your information could not be submitted at this time. Please try again later.<p>Error Message: $smtpoutput</body></html>";
    }
    else {
      print "Content-type: text/html\n\n$output";
    }
    Code (markup):
    upon submission I get this errors
    All help appreciated, tell me what I'm doing wrong and how I can fix it!

    Bonus $3 if you can tell me how to make the confirmed email field verify that the email inputted is the same as the email in the "email" field!

    I'll include a bonus $2 as a holiday bonus!

    Thank you all in Advance!
     
    Last edited: Dec 9, 2010
    alex894, Dec 9, 2010 IP
  2. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    As Seller:
    100% - 1
    As Buyer:
    100% - 1
    #2
    You need to CHMOD the .pl file involved to 755

    EDIT: This one caresubmit_test.pl
     
    Last edited: Dec 9, 2010
    MyVodaFone, Dec 9, 2010 IP
  3. dorafurr

    dorafurr Peon

    Messages:
    36
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #3
    my suggestion use free contact forms and put their script
    +it seems your server have problem to access the files,you should go to ftp and put access for all users.
     
    dorafurr, Dec 9, 2010 IP
  4. alex894

    alex894 Guest

    Messages:
    614
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #4
    is the perl code ok though? free ms scrips? where from? unfamiliar!
     
    alex894, Dec 9, 2010 IP
  5. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    As Seller:
    100% - 1
    As Buyer:
    100% - 1
    #5
    Since you changed the action= code I cant tell if it works or not, but at least your requested problem for a fix is fixed
     
    MyVodaFone, Dec 9, 2010 IP
  6. gamernaveen

    gamernaveen Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #6
    HTTP 500 responses are usually unspecific , server is not sure of exact details.
    Here are most common things which cause it ,
    Try troubleshooting them from point 1 and see if it fixes

    1) Did you save/upload the file as binary or ASCII ? this is one of the major problems in pl. people don't upload them in ASCII mode, so the script doesn't run correctly.

    2) . 777 permissions - if any of the PHP/Perl files have 777 permissions this will lead to '500 Internal Server Error'. The solution is to change their permissions to 755

    3) Check the HTTP error log for details. Also enable all warnings and errors. Do a "perl -wc scriptname.pl" on terminal to run and check syntax without executing.

    4) Use this statement "use strict;" in top of the script. Or is the path to send mail and cgi/modules correct?

    5) See the http web error log and let us know.
     
    gamernaveen, Dec 9, 2010 IP
  7. alex894

    alex894 Guest

    Messages:
    614
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #7
    It's been resolved! Thanks guys!


    Thank to Ryan for helping me with the coding!
     
    alex894, Dec 9, 2010 IP