Source files of fsfe.org, pdfreaders.org, freeyourandroid.org, ilovefs.org, drm.info, and test.fsfe.org. Contribute: https://fsfe.org/contribute/web/
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.

businesscards.pl 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #!/usr/bin/perl
  2. use CGI;
  3. use POSIX qw(strftime);
  4. # -----------------------------------------------------------------------------
  5. # Get parameters
  6. # -----------------------------------------------------------------------------
  7. my $query = new CGI;
  8. my $name = $query->param("name");
  9. my $function = $query->param("function");
  10. my $function2 = $query->param("function2");
  11. my $radioaddress = $query->param("address");
  12. my $otheraddress = $query->param("other_address");
  13. my $phone = $query->param("phone");
  14. my $mobile = $query->param("mobile");
  15. my $fax = $query->param("fax");
  16. my $email = $query->param("email");
  17. my $jabber = $query->param("jabber");
  18. my $fp = $query->param("fingerprint");
  19. my $amount = $query->param("amount");
  20. my $er = $query->param("er");
  21. my $delivery = $query->param("delivery_address");
  22. if ($function2 ne "") {
  23. $function .= ", $function2";
  24. }
  25. if ($radioaddress eq "Berlin") { $address = "Schönhauser Allee 6/7, 10119 Berlin, Germany"; }
  26. if ($radioaddress eq "other") { $address = "$otheraddress"; }
  27. if ($delivery eq "") {
  28. $delivery = "$address";
  29. }
  30. my $date = strftime "%Y-%m-%d", localtime;
  31. my $time = strftime "%s", localtime;
  32. my $reference = "bc.$date." . substr $time, -3;
  33. my $subject = "Business card order $reference";
  34. # -----------------------------------------------------------------------------
  35. # Generate mail to office
  36. # -----------------------------------------------------------------------------
  37. my $boundary = "NextPart$reference";
  38. my $replyto = "contact\@fsfe.org, $email";
  39. open(MAIL, "|/usr/lib/sendmail -t -f $email");
  40. print MAIL "From: $email\n";
  41. print MAIL "Reply-To: $replyto\n";
  42. print MAIL "Mail-Followup-To: $replyto\n";
  43. print MAIL "To: contact\@fsfe.org\n";
  44. print MAIL "Cc: $email\n";
  45. print MAIL "Subject: $subject\n";
  46. print MAIL "Mime-Version: 1.0\n";
  47. print MAIL "Content-Type: multipart/mixed; boundary=$boundary\n";
  48. print MAIL "Content-Transfer-Encoding: 8bit\n\n\n";
  49. print MAIL "--$boundary\n";
  50. print MAIL "Content-Type: text/plain; charset=utf-8\n";
  51. print MAIL "Content-Transfer-Encoding: 8bit\n\n";
  52. print MAIL "This business card order was sent via web interface\n\n";
  53. print MAIL "--$boundary\n";
  54. print MAIL "Content-Type: text/plain; charset=utf-8\n";
  55. print MAIL "Content-Disposition: attachment; filename=$reference.txt\n";
  56. print MAIL "Content-Description: Business card order\n";
  57. print MAIL "Content-Transfer-Encoding: 8bit\n\n";
  58. print MAIL "-----------------------------------------\n";
  59. print MAIL "Form for ordering business cards\n";
  60. print MAIL "-----------------------------------------\n\n";
  61. print MAIL "Full name: $name\n\n";
  62. print MAIL "Title: $function\n\n";
  63. print MAIL "Address: $address\n\n";
  64. print MAIL "Tel: +$phone\n\n";
  65. print MAIL "Mobile: +$mobile\n\n";
  66. print MAIL "Fax: +$fax\n\n";
  67. print MAIL "E-Mail: $email\n\n";
  68. print MAIL "XMPP: $jabber\n\n";
  69. print MAIL "Fingerprint: $fp\n\n";
  70. print MAIL "Number of business cards ordered: $amount\n\n";
  71. print MAIL "Delivery Address: $delivery\n\n";
  72. print MAIL "--$boundary--\n";
  73. close MAIL;
  74. # -----------------------------------------------------------------------------
  75. # Inform user that everything was ok
  76. # -----------------------------------------------------------------------------
  77. print "Content-type: text/html\n\n";
  78. print "Your order $reference was sent. Thank you.<br /><br />";