Source files of fsfe.org, pdfreaders.org, freeyourandroid.org, ilovefs.org, drm.info, and test.fsfe.org. Contribute: https://fsfe.org/contribute/web/ https://fsfe.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.3 KiB

  1. #!/usr/bin/perl
  2. use CGI;
  3. use POSIX qw(strftime);
  4. my $query = new CGI;
  5. my $date = strftime "%Y-%m-%d", localtime;
  6. my $time = strftime "%s", localtime;
  7. my $reference = "order.$date." . substr $time, -5;
  8. my $firstname = $query->param("firstname");
  9. my $lastname = $query->param("lastname");
  10. my $email = $query->param("email");
  11. my $address = $query->param("address");
  12. my $specifics = $query->param("specifics");
  13. my $comment = $query->param("comment");
  14. my $lang = $query->param("language");
  15. if (
  16. # validate input (more or less)
  17. ($firstname or $lastname)
  18. and $email
  19. and $address
  20. and $specifics
  21. and not $query->param("url")
  22. ) {
  23. #send mail
  24. open(MAIL, "|/usr/lib/sendmail -t -f promoorder\@fsfe.org");
  25. print MAIL
  26. "From: promoorder\@fsfe.org
  27. To: assist\@fsfe.org
  28. Cc: paul\@fsfe.org
  29. Subject: $reference $firstname $lastname
  30. Hey, someone ordered promotional material:
  31. First Name: $firstname
  32. Last Name: $lastname
  33. EMail: $email
  34. Address:
  35. $address
  36. Specifics of the Order:
  37. $specifics
  38. Comments:
  39. $comments
  40. Preferred language was: $lang
  41. KTHXBYE
  42. Your friendly automatic web order program.
  43. ";
  44. close MAIL;
  45. print "Location: /order/orderpromo-thanks.$lang.html\n\n";
  46. } else {
  47. #something was wrong with the input
  48. print "Location: /order/orderpromo-error.$lang.html\n\n";
  49. }