title: Paypal Sandbox payment problem
body: <p>I have the following post button that i use for paypal transactions:</p>
  
  <pre><code>    &lt;form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"&gt;
          &lt;input type="hidden" name="cmd" value="_xclick"&gt;
          &lt;input type="hidden" name="business" value="my@email.com"&gt;
          &lt;input type="hidden" name="item_name" value="Item description"&gt;
          &lt;input type="hidden" name="item_number" value="1"&gt;
          &lt;input type="hidden" name="amount" value="00.30"&gt;
          &lt;input type="hidden" name="no_shipping" value="1"&gt;
          &lt;input type="hidden" name="no_note" value="1"&gt;
          &lt;input type="hidden" name="currency_code" value="USD"&gt;
          &lt;input type="hidden" name="lc" value="US"&gt;
          &lt;input type="hidden" name="bn" value="PP-BuyNowBF"&gt;
          &lt;input type="hidden" name="return" value="website.com/index.php" /&gt;
          &lt;input type="hidden" name="cancel_return" value="website.com/index.php" /&gt;
          &lt;input type="hidden" name="rm" value="2"&gt;
          &lt;input type="hidden" name="notify_url" value="website.com/ipn/ipn.php"&gt;
          &lt;input type="hidden" name="custom" value="user_id"&gt;
          &lt;input type="submit" value="upgrade" /&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>and the following code in ipn.php</p>
  
  <pre><code>&lt;?php
  include_once 'config.php';
  // read the post from PayPal system and add 'cmd'
  $req = 'cmd=_notify-validate';
  
  foreach ($_POST as $key =&gt; $value) {
  $value = urlencode(stripslashes($value));
  $req .= "&amp;$key=$value";
  }
  
  // post back to PayPal system to validate
  $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
  $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
  $header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
      //$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);
  $fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);
  // assign posted variables to local variables
  $item_name = $_POST['item_name'];
  $item_number = $_POST['item_number'];
  $payment_status = $_POST['payment_status'];
  $payment_amount = $_POST['mc_gross'];
  $payment_currency = $_POST['mc_currency'];
  $txn_id = $_POST['txn_id'];
  $receiver_email = $_POST['receiver_email'];
  $payer_email = $_POST['payer_email'];
  
  if (!$fp) {
  // HTTP ERROR
  } else {
      fputs ($fp, $header . $req);
      while (!feof($fp)) {
          $res = fgets ($fp, 1024);
          if (strcmp ($res, "VERIFIED") == 0) {
              // check the payment_status is Completed
              // check that txn_id has not been previously processed
              // check that receiver_email is your Primary PayPal email
              // check that payment_amount/payment_currency are correct
              // process payment
              mysql_query("UPDATE table SET column='1' WHERE column2='13'");
          }
          else if (strcmp ($res, "INVALID") == 0) {
              // log for manual investigation
          }
      }
  fclose ($fp);
  }
  ?&gt;
  </code></pre>
  
  <p>when i click the upgrade button and pay, it doesnt show me a go back to the website button... but there is a go back to my@email.com button, which has a 10 sec delay and takes me back to my website... although it popups a warning about encrypted data, which i dont know what it is.</p>
  
  <p>Also the query i use in ipn.php does not execute.I dont even know if it goes to ipn.php.</p>