Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
squireless
/
Stripe
:
index.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php session_start(); require_once("../admin/database.php"); if(isset($_POST['final_checkout'])) { $order_id=rand(10,100000); $query="SELECT * from orders WHERE order_id='$order_id'"; $order=db::getRecord($query); if($order!=NULL) { while($order!=NULL) { $order_id=rand(10,100000); $query="SELECT * from orders WHERE order_id='$order_id'"; $order=db::getRecord($query); } } $_SESSION['order_id']=$order_id; $user_id=session_id(); $_SESSION['user_id']=$user_id; // print_r ($user_id); $query="SELECT * from temp_cart WHERE user_id='$user_id'"; $cart=db::getRecords($query); $size=NULL; if(is_array($cart)) { $size=sizeof($cart); } $db = db::open(); $name = $db->real_escape_string($_POST['fname']); $l_name = $db->real_escape_string($_POST['lname']); $f_name=$name." ".$l_name; $email = $db->real_escape_string($_POST['email']); $address = $db->real_escape_string($_POST['address']); $zip = $db->real_escape_string($_POST['postcode']); $city = $db->real_escape_string($_POST['city']); $phone = $db->real_escape_string($_POST['phone']); $order_note = $db->real_escape_string($_POST['note']); $total_bill = $_POST['total_amount']; $payment_method = "Stripe"; $payment_status = "Unpaid"; $total_products=$size; $min_amount=0; $query="SELECT * from amount"; $getmin_amount=db::getRecord($query); $min_amount=$getmin_amount['price']; if($total_bill>=$min_amount){ if($cart!=null) { foreach($cart as $cart2) { $product_id=$cart2['product_id']; $quantity=$cart2['quantity']; $query="SELECT * from product WHERE id='$product_id'"; $product=db::getRecord($query); $query="SELECT * from product where id='$product_id'"; $product=db::getRecord($query); $product_name = $product['name']; $product_price = $product['price']; $size = $cart2['size']; $query="INSERT into order_detail (order_id,user_id,product_id,product_name,quantity,total,size) VALUES ('$order_id','$user_id','$product_id','$product_name','$quantity','$product_price','$size')"; $insert=db::query($query); } } $query="INSERT into orders (order_id,user_id,name,email,address,postcode,city,phone,note,total_products,total_bill,payment_status,payment_method) VALUES ('$order_id','$user_id','$f_name','$email','$address','$zip','$city','$phone','$order_note','$total_products','$total_bill','$payment_status','$payment_method')"; $insert=db::query($query); }else{ echo "<script>location='../near_partner.php?status=near_partner&&zip=$zip'</script>"; exit(); } $total_bill=$total_bill * 100; $_SESSION['total_bill']=$total_bill; $shoping = "Magik Nectar"; } ?> <?php require_once('vendor/autoload.php'); \Stripe\Stripe::setApiKey('sk_test_51GqlfCKq0N6dc2TiusCuMRt9itHdJUp5RCr9sHAskVJjV3ZWFzj9U5wmv6UTaowfnQshuVv8OEt14ZLDvoHjlbju00S07FATcM'); $session = \Stripe\Checkout\Session::create([ 'payment_method_types' => ['card'], 'line_items' => [[ 'price_data' => [ 'currency' => 'GBP', 'product_data' => [ 'name' => $shoping, ], 'unit_amount' => $total_bill, ], 'quantity' => 1, ]], 'mode' => 'payment', 'success_url' => 'https://magiknectar.com/Stripe/charge.php', 'cancel_url' => 'https://magiknectar.com/', /*'success_url' => 'http://localhost:8080/juice_shop_v2/Stripe/charge.php', 'cancel_url' => 'http://localhost:8080/juice_shop_v2/',*/ ]); ?> <html> <head> <script src="https://js.stripe.com/v3/"></script> </head> <body> <script> var stripe = Stripe('pk_test_51GqlfCKq0N6dc2TiMzyqMCW9V87oSYkePdjJPJBnRPOSqXITTQehHmJmLWGfAef2wwEeW1DatTCLvVg32BWcfArS00CukoptZJ'); stripe.redirectToCheckout({ sessionId: "<?php echo $session->id; ?>" }); </script> </body> </html>