ok
Direktori : /proc/thread-self/root/home2/selectio/www/tnssa/api/ |
Current File : //proc/thread-self/root/home2/selectio/www/tnssa/api/donation-add-api.php |
<?php include"../../admin/config/config.php"; require 'PHPMailer/class.phpmailer.php'; $mail = new PHPMailer(true); //POST using u will Get All Data $razorpay_payment_id=$_POST['razorpay_payment_id']; $razorpay_order_id=$_POST['razorpay_order_id']; $member_id=''; $password=''; //if(isset($_POST['btn_submit'])){ try{ $date = date('Y-m-d h:i:s a', time()); if(isset($_FILES['donation_logo']) && $_FILES["donation_logo"]["name"]!=""){ $extension = end(explode(".", $_FILES["donation_logo"]["name"])); $image = rand(10,1000000000)."-".$date."-image." . $extension; $upload = move_uploaded_file($_FILES['donation_logo']['tmp_name'], 'donation-logo/' . $image); $upload_image = 'donation-logo/' . $image; } else{ $upload_image=''; } $statement = $pdo->prepare("INSERT INTO `tbl_donation`(`name`, `mobile_no`, `email`, `amount`, `payment_id`, `order_id`, `city`, `district`, `address`, `content`, `logo`, `status`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)"); $result=$statement->execute(array($_POST['name'],$_POST['mobile_no'],$_POST['email'],$_POST['amount'],$razorpay_payment_id,$razorpay_payment_id,$_POST['city'],$_POST['district'],$_POST['address'],$_POST['description'],$upload_image,1)); $donation_id = $pdo->lastInsertId(); $don_id='DONATION - '.str_pad($donation_id, 3, "0", STR_PAD_LEFT); if($result){ $statement = $pdo->prepare("UPDATE tbl_donation SET donation_id = '$don_id' WHERE id =$donation_id"); $results=$statement->execute(); /* New Events Table Insert Query Starts Here*/ $data['code'] = '200'; $data['email'] = 'put seneted Mail id'; $data['message'] = 'Donation Compelted'; //put Mail sending Source Code.... here $postData = array( 'skater_register'=>'1', 'email'=>$_POST['email'], 'register_id'=>$don_id, 'name'=>$_POST['name'], 'mobile'=>$_POST['mobile_no'], 'amount'=>$_POST['amount'], 'transacction_id'=>$razorpay_payment_id, ); //API URL $url = "https://firstmatrix.in.net/tnssa-email-api/donation.php"; // init the resource $ch = curl_init(); curl_setopt_array($ch, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $postData )); //Ignore SSL certificate verification curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); //get response $output = curl_exec($ch); }else{ $data['code'] = '500'; $data['email'] = 'put seneted Mail id'; $data['message'] = 'Registartion Failed...'; error_log($data['message']); } echo json_encode($data); }catch(Exception $e){ $data['code'] = '500'; $data['email'] = 'put seneted Mail id'; $data['message'] = $e; error_log($e); echo json_encode($data); } // } ?>