Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Sep 25th, 2012  |  syntax: PHP  |  size: 2.83 KB  |  views: 32  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  <script type="text/javascript">
  2. function submitt()
  3. {
  4. setTimeout('document.paypal.submit()',1000);
  5. }
  6. </script>
  7.  
  8.  
  9. <?php
  10. $Amount  = $_REQUEST['amount'];
  11. $to      = "info.whatzup@gmail.com";
  12. $from    = $_REQUEST['email'];
  13. $name    = $_REQUEST['Name'];
  14. $headers = "From: $from" . PHP_EOL;
  15. $subject = "Classified Ad submission";
  16.  
  17. $fields                         = array();
  18. $fields["Name"]                 = "\nName";
  19. $fields["email"]                = "\nEmail";
  20. $fields["Phone"]                = "\nPhone";
  21. $fields["WorkPhone"]            = "\nWork Phone";
  22. $fields["Address"]              = "\nStreet Address";
  23. $fields["City"]                 = "City";
  24. $fields["State"]                = "State";
  25. $fields["Zip"]                  = "Zip Code";
  26. $fields["Classification"]       = "\nClassification";
  27. $fields["Ad-Headline"]          = "\nHeadline";
  28. $fields["Other-Classification"] = "\nAlternate Classification";
  29. $fields["Ad-Content"]           = "\nAd Content";
  30. $fields["Words"]                = "\nWord Count";
  31. $fields["Weeks"]                = "\nWeeks to Run";
  32. $fields["WordCount"]            = "\nTotal Words";
  33. $fields["Rate"]                 = "\nWord Rate";
  34. $fields["GrossAmountDue"]       = "\nGross Amount";
  35. $fields["NonProfit"]            = "\nNon Profit Ad?";
  36.  
  37.  
  38. $body = "This Ad has been submitted:\n\n";
  39. foreach ($fields as $a => $b) {
  40.     $body .= sprintf("%20s: %s\n", $b, $_REQUEST[$a]);
  41. }
  42.  
  43. if ($from == '') {
  44.     print "You have not entered an email, please go back and try again";
  45. } else {
  46.     if ($name == '') {
  47.         print "You have not entered a name, please go back and try again";
  48.     } else {
  49.         $send = mail($to, $subject, $body, "From: Classified-Ad@whatzup.com" . PHP_EOL);
  50.         if ($send) {
  51.             print "Thank you $Name, your Ad has been submitted, redirecting to paypal.";
  52.             echo "<SCRIPT LANGUAGE='javascript'>submitt();</SCRIPT>";
  53.         } else {
  54.             print "Sorry $Name, but we encountered an error sending your form, please notify info.whatzup@gmail.com, or call us at XXXXXXXXXXXXXX.";
  55.         }
  56.     }
  57. }
  58.  
  59. <form action="https://www.paypal.com/cgi-bin/webscr" id="paypal" onClick="sendtotal()" target="_top" name="paypal" method="post">
  60. <input type="hidden" name="cmd" value="_xclick">
  61. <input type="hidden" name="business" value="XXXXXXXXXXX">
  62. <input type="hidden" name="lc" value="US">
  63. <input type="hidden" name="item_name" value="Classified Ad">
  64. <input type="hidden" name="amount" value="<?php echo $_POST['amount']; ?>" />
  65. <input type="hidden" name="currency_code" value="USD">
  66. <input type="hidden" name="button_subtype" value="services">
  67. <input type="hidden" name="no_note" value="0">
  68. <input type="hidden" name="cn" value="Add special instructions to the seller:">
  69. <input type="hidden" name="no_shipping" value="1">
  70. <input type="hidden" name="shipping" value="0.00">
  71. </form>