Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code>$paypal_email = '5345345345345f'; $cur_dir='http://'.$_SERVER['SERVER_NAME'] . dirname($_SERVER['REQUEST_URI']); $return_url = $cur_dir.'/paymentsucess.php'; $cancel_url = $cur_dir.'/payment-not-sucess.php'; $notify_url = $cur_dir.'/payments.php'; extract($_POST); $item_name = $exam_name; $item_amount = $amount; $userid=$userid; if (!isset($_POST["txn_id"]) &amp;&amp; !isset($_POST["txn_type"])){ $querystring = "?business=".urlencode($paypal_email)."&amp;"; $querystring .= "item_name=".urlencode($item_name)."&amp;"; $querystring .= "amount=".urlencode($item_amount)."&amp;"; //loop for posted values and append to querystring foreach($_POST as $key =&gt; $value){ $value = urlencode(stripslashes($value)); $querystring .= "$key=$value&amp;"; } $querystring .= "return=".urlencode(stripslashes($return_url))."&amp;"; $querystring .= "cancel_return=".urlencode(stripslashes($cancel_url))."&amp;"; $querystring .= "notify_url=".urlencode($notify_url); header('location:https://www.paypal.com/cgi-bin/webscr'.$querystring); exit(); }else{ $req = 'cmd=_notify-validate'; foreach ($_POST as $key =&gt; $value) { $value = urlencode(stripslashes($value)); $value = preg_replace('/(.*[^%^0^D])(%0A) (.*)/i','${1}%0D%0A${3}',$value);// IPN fix $req .= "&amp;$key=$value"; } $data['item_name'] = $_POST['item_name']; $data['item_number'] = $_POST['item_number']; $data['payment_status'] = $_POST['payment_status']; $data['payment_amount'] = $_POST['mc_gross']; $data['payment_currency'] = $_POST['mc_currency']; $data['txn_id'] = $_POST['txn_id']; $data['receiver_email'] = $_POST['receiver_email']; $data['payer_email'] = $_POST['payer_email']; $data['custom'] = $_POST['custom']; $data['userid'] = $_POST['userid']; // 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); if (!$fp) { // HTTP ERROR } else { fputs ($fp, $header . $req); while (!feof($fp)) { $res = fgets ($fp, 1024); if (strcmp ($res, "VERIFIED") == 0) { // Validate payment (Check unique txnid &amp; correct price) $valid_txnid = check_txnid($data['txn_id']); $valid_price = check_price($data['payment_amount'], $data['item_number']); // PAYMENT VALIDATED &amp; VERIFIED! if($valid_txnid &amp;&amp; $valid_price){ $orderid = updatePayments($data); if($orderid){ }else{ } }else{ } }else if (strcmp ($res, "INVALID") == 0) { } } fclose ($fp); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload