Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Dodanie rekordu - przekierowanie do płatności
boro11
post
Post #1





Grupa: Zarejestrowani
Postów: 283
Pomógł: 11
Dołączył: 9.07.2010
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


Witam!

Mam taki kod:

  1. <?
  2.  
  3. require_once ('../connection.php');
  4. connection();
  5.  
  6. $upgrade = $_GET["upgrade"];
  7. $username = $_GET["username"];
  8. $price = $_GET["price"];
  9. $date = date("Y-m-d");
  10.  
  11. //formularz
  12.  
  13. if (isset($_POST['submit']))
  14. {
  15. $zapytanie = "INSERT INTO test_buyprem ( id, amount, nick, date) VALUES (' ', '$upgrade', '$username', '$date')";
  16. mysql_query($zapytanie) or die(mysql_error());
  17. }
  18.  
  19. ?>


  1. <!DOCTYPE HTML>
  2.  
  3. <script language="javascript" type="text/javascript" src="https://refbackbank.com/adm/niceforms.js"></script>
  4. <link rel="stylesheet" type="text/css" media="all" href="https://refbackbank.com/adm/niceforms-default.css" />
  5.  
  6. <style type="text/css">
  7. p {
  8. font-family: "Trebuchet MS", Arial, sans-serif;
  9. font-size: 10pt;
  10. }
  11. h3 {
  12. font-family: "Trebuchet MS", Arial, sans-serif;
  13. color: #666;
  14. }
  15.  
  16. </style>
  17.  
  18. </head>
  19.  
  20. <body>
  21.  
  22.  
  23.  
  24. <h3>Dear <?if($_SESSION['login'])
  25. {
  26. echo $username;
  27. ?>,</h3>
  28. <p>You are going to upgrade your account to <strong><?=$upgrade;?></strong>, please make sure that you have <strong><?=$price?>$</strong> on payment processor which you want to use to complet your order.</p>
  29. <br />
  30.  
  31. <form action="https://www.paypal.com/cgi-bin/webscr" method="POST" target="_top" style="display:inline;">
  32. <input type="hidden" name="cmd" value="_xclick">
  33. <input type="hidden" name="business" value="adrianos1992@gmail.com">
  34. <input type="hidden" name="lc" value="US">
  35. <input type="hidden" name="item_name" value="<?=$upgrade;?> - <?=$username;?>">
  36. <input type="hidden" name="amount" value="<?=$price;?>.00">
  37. <input type="hidden" name="currency_code" value="USD">
  38. <input type="hidden" name="button_subtype" value="services">
  39. <input type="hidden" name="no_note" value="0">
  40. <input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest">
  41. <input type="image" src="https://refbackbank.com/images/paypal.jpg" border="0" name="submit" id="submit" value="submit" alt="PayPal - The safer, easier way to pay online!">
  42. </form>
  43.  
  44. <form method="post" action="https://www.alertpay.com/PayProcess.aspx" target="_top" style="display:inline;">
  45. <input type="hidden" name="ap_merchant" value="money@refbackbank.com"/>
  46. <input type="hidden" name="ap_purchasetype" value="service"/>
  47. <input type="hidden" name="ap_itemname" value="<?=$upgrade;?> - <?=$username;?>"/>
  48. <input type="hidden" name="ap_amount" value="<?=$price;?>"/>
  49. <input type="hidden" name="ap_currency" value="USD"/>
  50. <input type="image" src="https://refbackbank.com/images/alertpay.jpg"/>
  51. </form>
  52.  
  53. <form action="https://sci.libertyreserve.com/en" method="GET" target="_top" style="display:inline;">
  54. <input type="hidden" name="lr_acc" value="U8279191">
  55. <input type="hidden" name="lr_amnt" value="<?=$price;?>.00">
  56. <input type="hidden" name="lr_currency" value="LRUSD">
  57. <input type="hidden" name="lr_comments" value="<?=$upgrade;?> - <?=$username;?>">
  58. <input type="hidden" name="lr_success_url" value="https://www.refbackbank.com/successfully/">
  59. <input type="hidden" name="lr_success_url_method" value="GET">
  60. <input type="hidden" name="lr_fail_url" value="https://www.refbackbank.com/fail/">
  61. <input type="hidden" name="lr_fail_url_method" value="GET">
  62. <input type="hidden" name="test" value="pass">
  63. <input type="image" src="https://refbackbank.com/images/LibertyReserve.jpg" /></a>
  64. </form>
  65.  
  66. </div>
  67.  
  68. <?
  69. }
  70. else
  71. {
  72. ?>
  73. Guest, </h3>
  74.  
  75. <p>You must login to use this feature.</p>
  76.  
  77. <?
  78. }
  79. ?>
  80. </body>
  81.  
  82. </html>


Wszelka funkcjonalność związana z płatnościami działa, ale nie działa dodawanie do bazy. Podobnej konstrukcji tj:

  1. if (isset($_POST['submit']))
  2. {
  3. $zapytanie = "INSERT INTO test_buyprem ( id, amount, nick, date) VALUES (' ', '$upgrade', '$username', '$date')";
  4. mysql_query($zapytanie) or die(mysql_error());
  5. }



Używam w innej części serwisu i tam działa bez problemu, ale tutaj niestety nie chce.
Czy dzieje się tak dlatego, że wartości przekazywane do bazy mają inne nazwy niż pola w tabeli, czy może dlatego że użyłem $GET zamiast $POST?
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 30.09.2025 - 20:58