/
home
/
mantaraham
/
www
/
event
/
video
/
File Upload :
llllll
Current File: /home/mantaraham/www/event/video/payment.php
<?php include("funcs.php"); // Save Record $fullname = makesafe(trim($_POST['fullname'])); $yourmail = makesafe(trim($_POST['yourmail'])); $email = makesafe(trim($_POST['email'])); $yourmobile = makesafe(trim($_POST['yourmobile'])); $coupon = makesafe(trim($_POST['coupon'])); // Calculate Discount: if (md5($coupon)=="0e9a3ff2c6ad1863d0ea5439ffa94b3a"){ $price = 600000; } elseif (md5($coupon)=="3ee8960d2dbb1d7ebcafcf93cb8f86b7"){ $price = 240000; } elseif (md5($coupon)=="5e4572121df63a0d9fb23dddd1c56e02"){ $price = 0; } else { $price = 1200000; } $amount = 0; $checkbox1 = makesafe(trim($_REQUEST['checkbox1'])); if ($checkbox1>0) { $amount = $amount+$price; $desc = $desc.' 1 '; }; $checkbox2 = makesafe(trim($_REQUEST['checkbox2'])); if ($checkbox2>0) { $amount = $amount+$price; $desc = $desc.' 2 '; }; $checkbox3 = makesafe(trim($_REQUEST['checkbox3'])); if ($checkbox3>0) { $amount = $amount+$price; $desc = $desc.' 3 '; }; $checkbox4 = makesafe(trim($_REQUEST['checkbox4'])); if ($checkbox4>0) { $amount = $amount+$price; $desc = $desc.' 4 '; }; $checkbox5 = makesafe(trim($_REQUEST['checkbox5'])); if ($checkbox5>0) { $amount = $amount+$price; $desc = $desc.' 5 '; }; // CLIENT INFORMATION // $captcha = (int)(latin_num(trim($_POST['captcha']))); $ip = getRealIpAddr(); // $key = $_SESSION['key']; if ((($email=='') AND ($yourmail!='') AND ($amount>0)) OR ($price==0)) { $date = date('Y-m-d'); $time = gmdate('H:i', (4.5*3600)+time()); // $repeated = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM `orders` WHERE `yourmail`='$yourmail' AND `amount`='$amount'"),0); $ok = @mysql_query("INSERT INTO `orders` (`fullname`, `yourmail`, `yourmobile`, `desc`, `date`,`time`,`ip`,`amount`) VALUES ('$fullname','$yourmail', '$yourmobile', '$desc', '$date','$time','$ip','$amount')"); if ($ok) { $show = @mysql_fetch_array(mysql_query("SELECT * FROM `orders` WHERE `yourmail`='$yourmail' ORDER BY `id` DESC LIMIT 0,1"),0); if ($price==0) { header('Location: http://event.mantaraham.ir/video/callback.php?mode=free&order_id='.$show[0] ); } else { // CURL $params = array( 'order_id' => $show[0], 'amount' => $amount, 'name' => $fullname, 'phone' => $yourmobile, 'mail' => $yourmail, 'desc' => $desc, 'callback' => 'http://event.mantaraham.ir/video/callback.php', 'reseller' => null, ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://api.idpay.ir/v1.1/payment'); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'X-API-KEY: 6485f16e-0bd4-4bc9-9ecf-d9b2ae960a75', 'X-SANDBOX: 0' )); $result = curl_exec($ch); curl_close($ch); // var_dump($result); $result = json_decode($result, true); // log $order_id = $show[0]; $payment_id = $result['id']; $date = date('Y-m-d').' '.gmdate('H:i', (3.5*3600)+time()); $ok = @mysql_query("INSERT INTO `gotopayment` (`order_id`, `payment_id`, `date`) VALUES ('$order_id', '$payment_id', '$date')"); header('Location: '. $result['link']); } } else echo "خطای ثبت در دیتابیس :("; } else echo "درج ایمیل و انتخاب حداقل یک ویدیو ضروری است!"; ?>
Copyright ©2k19 -
Hexid
|
Tex7ure