$sql = sprintf("INSERT INTO jpdrills_pending_users (username, email, password, signup) VALUES('%s','%s','%s',now())", $u, $e, $pHashed); $query = mysql_query($sql) or error_log(mysql_error()); if ($query) { $query = "SELECT id FROM jpdrills_pending_users WHERE username='******' LIMIT 1"; $result = mysql_query($query) or error_log(mysql_error()); list($id_temp) = mysql_fetch_row($result); echo "Query Success"; echo '<div class="wait">PayPal is processing the payment, please wait...</div>'; echo '<div class="loader"> <div></div> <div></div> <div></div> <div></div> <div></div> </div>'; echo infotutsPaypal($data, $id_temp); } else { echo "Fail"; exit; } } else { ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Register to receive access to our Flashcards-with-a-twist.</title> <!--<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">--> <!--<link rel="stylesheet" type="text/css" href="css/readable.bootstrap.min.css">-->
//Get from db later, depends on currency and exchange rate. $t3 = 3; } else { if ($_POST['plan'] == 'Monthly') { $plan = 'JPDrills Platinum'; $price = 14.99; //Get from db later, depends on currency and exchange rate. $t3 = 1; } else { //Shouldn't be any other plan other than the first two echo "paypal_fail"; exit; } } $data = array('merchant_email' => '*****@*****.**', 'product_name' => $plan, 'amount' => $price, 'currency_code' => $currency_code, 'thanks_page' => "http://" . $_SERVER['HTTP_HOST'] . '/thankyou.php', 'notify_url' => "http://" . $_SERVER['HTTP_HOST'] . '/ipn.php', 'cancel_url' => "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 't3' => $t3, 'paypal_mode' => true); echo json_encode(infotutsPaypal($data, "1")); function infotutsPaypal($data, $id_temp) { define('SSL_URL', 'https://www.paypal.com/cgi-bin/webscr'); define('SSL_SAND_URL', 'https://www.sandbox.paypal.com/cgi-bin/webscr'); $action = ''; //Is this a test transaction? $action = $data['paypal_mode'] ? SSL_SAND_URL : SSL_URL; $form = ''; $form .= '<form name="frm_payment_method" action="' . $action . '" method="post">'; $form .= '<input type="hidden" name="business" value="' . $data['merchant_email'] . '" />'; // Instant Payment Notification & Return Page Details / $form .= '<input type="hidden" name="notify_url" value="' . $data['notify_url'] . '" />'; //ipn $form .= '<input type="hidden" name="cancel_return" value="' . $data['cancel_url'] . '" />'; //if cancel, go here
<div class="row" id="placeTheOrder"> <button type="submit" class="btn btn-default btn-md" name="orderButton">PLACE THE ORDER</button> <?php $data = array('merchant_email' => '*****@*****.**', 'product_name' => 'Order Price', 'amount' => orderTotal($uid), 'currency_code' => 'USD', 'thanks_page' => "http://" . $_SERVER['HTTP_HOST'] . 'paypal/thank.php', 'notify_url' => "http://" . $_SERVER['HTTP_HOST'] . 'paypal/ipn.php', 'cancel_url' => "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'paypal_mode' => true); ?> <br> <form id='paypal-info' method='post' action='#'> <input type='submit' name='pay_now' id='pay_now' value='Pay with PayPal' /> </form> <?php if (isset($_POST['pay_now'])) { echo infotutsPaypal($data); } function infotutsPaypal($data) { define('SSL_URL', 'https://www.paypal.com/cgi-bin/webscr'); define('SSL_SAND_URL', 'https://www.sandbox.paypal.com/cgi-bin/webscr'); $action = ''; //Is this a test transaction? $action = $data['paypal_mode'] ? SSL_SAND_URL : SSL_URL; $form = ''; $form .= '<form name="frm_payment_method" action="' . $action . '" method="post">'; $form .= '<input type="hidden" name="business" value="' . $data['merchant_email'] . '" />'; // Instant Payment Notification & Return Page Details / $form .= '<input type="hidden" name="notify_url" value="' . $data['notify_url'] . '" />'; $form .= '<input type="hidden" name="cancel_return" value="' . $data['cancel_url'] . '" />'; $form .= '<input type="hidden" name="return" value="' . $data['thanks_page'] . '" />';