Advertisement
Guest User

Untitled

a guest
Jul 28th, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.25 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. echo "POST variables<br>";
  5. var_dump($_POST);
  6.  
  7. echo "<br><br>SESSION variables<br>";
  8. var_dump($_SESSION);
  9.  
  10.  
  11. $itemcount = isset($_SESSION['itemcount']) ? $_SESSION['itemcount'] : 0;
  12. if ($itemcount == 0) {
  13. header("Location: "."error.php?msg=".rawurlencode("Please add items to your shopping cart before checking out."));
  14. exit;
  15. }
  16.  
  17. echo "POST email value: ".($_POST['email'])."<br>";
  18.  
  19. if (!isset($_POST['email'])) { // <-- FAILS HERE
  20. header("Location: "."error.php?msg=".rawurlencode("We did not find your information, please enter the needed information again."));
  21. exit;
  22. }
  23.  
  24. echo "server request method: ".$_SERVER['REQUEST_METHOD'];
  25. if ($_SERVER['REQUEST_METHOD'] == 'POST')
  26. {
  27. $_SESSION['shipname'] = $_POST['shipname'];
  28. $_SESSION['shipaddress'] = $_POST['shipaddress'];
  29. $_SESSION['shipzip'] = $_POST['shipzip'];
  30. $_SESSION['shipcity'] = $_POST['shipcity'];
  31. $_SESSION['shipstate'] = $_POST['shipstate'];
  32.  
  33. $_SESSION['paymenttype'] = "PayPal";
  34. header("Location: "."thankyou.php");
  35. }
  36.  
  37. $shipname = isset($_SESSION['shipname']) ? $_SESSION['shipname'] : '';
  38. $shipaddress = isset($_SESSION['shipaddress']) ? $_SESSION['shipaddress'] : '';
  39. $shipzip = isset($_SESSION['shipzip']) ? $_SESSION['shipzip'] : '';
  40. $shipcity = isset($_SESSION['shipcity']) ? $_SESSION['shipcity'] : '';
  41. $shipstate = isset($_SESSION['shipstate']) ? $_SESSION['shipstate'] : '';
  42.  
  43. ?>
  44.  
  45. POST variables
  46. array(11) {
  47. ["lastname"]=> string(6) "dfgdfg"
  48. ["email"]=> string(22) "kelliemmarsh@gmail.com"
  49. ["city"]=> string(8) "van nuys"
  50. ["fax"]=> string(0) ""
  51. ["state"]=> string(2) "WA"
  52. ["firstname"]=> string(5) "dfbdf"
  53. ["address2"]=> string(0) ""
  54. ["phone"]=> string(12) "509-555-1414"
  55. ["zip"]=> string(5) "90266"
  56. ["address"]=> string(14) "123 any street"
  57. ["Continue"]=> string(8) "Continue"
  58. }
  59. SESSION variables
  60. array(8) {
  61. ["cart"]=> array(4) {
  62. [0]=> array(6) {
  63. [0]=> string(6) "ch-002"
  64. [1]=> string(6) "ch-002"
  65. [2]=> string(0) ""
  66. [3]=> string(0) ""
  67. [4]=> string(0) ""
  68. [5]=> string(0) ""
  69. }
  70. [1]=> array(6) {
  71. [0]=> string(26) "Fish Wavy Stripe Turquoise"
  72. [1]=> string(26) "Fish Wavy Stripe Turquoise"
  73. [2]=> string(0) ""
  74. [3]=> string(0) ""
  75. [4]=> string(0) ""
  76. [5]=> string(0) ""
  77. }
  78. [2]=> array(6) {
  79. [0]=> int(1)
  80. [1]=> int(2)
  81. [2]=> string(0) ""
  82. [3]=> string(0) ""
  83. [4]=> string(0) ""
  84. [5]=> string(0) ""
  85. }
  86. [3]=> array(6) {
  87. [0]=> string(5) "10.99"
  88. [1]=> string(5) "10.99"
  89. [2]=> string(0) ""
  90. [3]=> string(0) ""
  91. [4]=> string(0) ""
  92. [5]=> string(0) ""
  93. }
  94. }
  95. ["itemcount"]=> int(2)
  96. ["shipname"]=> NULL
  97. ["shipaddress"]=> NULL
  98. ["shipzip"]=> NULL
  99. ["shipcity"]=> NULL
  100. ["shipstate"]=> NULL
  101. ["paymenttype"]=> string(6) "PayPal"
  102. }
  103.  
  104. POST email value: kelliemmarsh@gmail.com
  105. server request method: POST
  106.  
  107. if (empty($_POST['email'])) {
  108. header("Location: "."error.php?msg=".rawurlencode("We did not find your information, please enter the needed information again."));
  109. exit;
  110. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement