JezK
Edit File: payment_failure.php
<?php error_reporting(0); include_once("payment_header.php"); include_once 'databaseConn.php'; $DatabaseCo =new DatabaseConn(); include_once './lib/requestHandler.php'; include_once './class/Config.class.php'; $configObj = new Config(); $txnid=isset($_POST["txnid"])?$_POST["txnid"]:''; $posted_hash=isset($_POST["hash"])?$_POST["hash"]:''; $key=$_POST["key"]; $productinfo=isset($_POST["productinfo"])?$_POST["productinfo"]:''; $mihpayid=$_POST['mihpayid']; //userPayedId $transaction_id=$_POST['payuMoneyId']; //Transaction ID $franchisedId=$_POST["udf1"]; //FranchaseID $plan_amount=$_POST["udf3"]; $tax_amount=$_POST["udf2"]; $userNewEmail=$_POST["udf4"]; //Customer newEmail typed if($txn_id!='') { $status = "Success"; } $website = $configObj->getConfigName(); $webfriendlyname = $configObj->getConfigFname(); $from = $configObj->getConfigFrom(); //$uid = isset($_GET['uid']) ? $_GET['uid'] : $_SESSION['uid'] ; $uid = isset($_GET['user']) ? base64_decode($_GET['user']) : $_SESSION['uid'] ; $payumoney=mysqli_fetch_object($DatabaseCo->dbLink->query("select * from payment_method where pay_name='Payumoney'")); $salt = $payumoney->access_code; $status = "Success"; If (isset($_POST["additionalCharges"])) { $additionalCharges=$_POST["additionalCharges"]; $retHashSeq = $additionalCharges.'|'.$salt.'|'.$status.'|||||||||||'.$email.'|'.$firstname.'|'.$productinfo.'|'.$amount.'|'.$txnid.'|'.$key.'|'.$udf1; } else { $retHashSeq = $salt.'|'.$status.'|||||||||||'.$email.'|'.$firstname.'|'.$productinfo.'|'.$amount.'|'.$txnid.'|'.$key.'|'.$udf1; } $hash = hash("sha512", $retHashSeq); $status = "Failure"; $get_data=mysqli_fetch_object(mysqli_query($DatabaseCo->dbLink,"select address,mobile,username,email,franchised_by,firstname from register where index_id='$uid'")); $status="None"; if($get_data->username!='') $firstname=$get_data->username; else $firstname=$get_data->firstname; $planid= isset($_GET["plan_id"]) ? base64_decode($_GET["plan_id"]) : $p_plan ; if($userNewEmail!='') $email=$userNewEmail; else $email=$get_data->email; $mobilenum=$get_data->mobile; //$salt="4Szn5Buq5x"; $address=$get_data->address; $fetch_plan=mysqli_fetch_array(mysqli_query($DatabaseCo->dbLink,"select * from membership_plan where plan_id='".$planid."'")); $plan_name=$fetch_plan['plan_name']; $plan_duration =$fetch_plan['plan_duration']; $profile=$fetch_plan['profile']; $amount= isset($_GET['amount']) ? $_GET['amount'] : $amount ; $plan_amount_type=$fetch_plan['plan_amount_type']; $plan_contacts=$fetch_plan['plan_contacts']; $plan_free_msg=$fetch_plan['plan_msg']; $video=$fetch_plan['video']; $chat=$fetch_plan['chat']; $plan_contacts=$fetch_plan['plan_contacts']; $plan_originalamount=$fetch_plan['plan_amount']; $pactive_dt= date('Y-m-d'); $date = strtotime(date("Y-m-d", strtotime($pactive_dt)) . + $plan_duration." day"); $exp_date=date('Y-m-d', $date); $tax_yes_no= $configObj->getConfigTaxYesNo(); $tax_name= $configObj->getConfigTaxName(); $tax_per= $configObj->getConfigTaxPercentage(); $query01="UPDATE `register` SET franchised_by='$franchisedId' WHERE index_id='$uid'"; $del_old=mysqli_query($DatabaseCo->dbLink,"update payments set current_plan='No' where user_id='$uid'"); $qury20="INSERT INTO `payments` (`payid`, `pmatri_id`, `pname`, `pemail`,`paddress`, `paymode`,`pactive_dt`,`p_plan`,`plan_duration`,`profile`, `video`,`chat`,`p_no_contacts`,`p_amount`,`p_bank_detail`,`pay_id`,`p_msg`,`r_profile`,`r_cnt`,`r_sms`,`exp_date`,`tax_name`,`tax_per`,`current_plan`,`txnid`,`mihpayid`,`transaction_id`,`payment_status`,`user_id`,`plan_id`) VALUES (NULL, '$mid', '".$firstname."', '$email', '$address', '".$_REQUEST['pay_gateway']."', '$pactive_dt', '$plan_name', '$plan_duration', '$profile', 'Yes', 'Yes', '$plan_contacts', '".$plan_amount_type." ".$amount."', '', '$txnid', '$plan_free_msg', '0', '0', '0', '$exp_date', '$tax_name', '$tax_per', 'Yes','$txnid','$mihpayid','$transaction_id','0','$uid','$planid')"; $res1=mysqli_query($DatabaseCo->dbLink,$qury20) or die(mysqli_error($DatabaseCo->dbLink)); mysqli_query($DatabaseCo->dbLink,$query01); // send email for payment success// $subject ="Your payment has been failed"; $message="<div style='background:url(https://r2gmatrimony.com/emailtemplate2.jpg);background-size:100%;padding:95px 30px 0px 20px;'><p style='color:#333;'><b>Dear ".ucfirst($firstname)."</b>,<br> Sorry!. Your Payment has been failed in R2G.please check your card available balance exists or not. If you have any issue regarding your membership plan, please feel free to reach us. Thank you for helping us to reach you better, <p style='text-align:center;color:#333;'><b>Failed Order Details</b></p> <table style='width:100%'> <tr> <td style='border: 1px solid #333;text-align: left;padding: 8px;color:#333;'><b>Name</b></td> <td style='border: 1px solid #333;text-align: left;padding: 8px;color:#333;'><b>".$firstname."</b></td> </tr> <tr> <td style='border: 1px solid #333;text-align: left;padding: 8px;color:#333;'><b>Email</b></td> <td style='border: 1px solid #333;text-align: left;padding: 8px;color:#333;'><b>".$email."<b></td> </tr> <tr> <td style='border: 1px solid #333;text-align: left;padding: 8px;color:#333;'><b>Mobile</b></td> <td style='border: 1px solid #333;text-align: left;padding: 8px;color:#333;'><b>".$mobilenum."</b></td> </tr> <tr> <td style='border: 1px solid #333;text-align: left;padding: 8px;color:#333;'><b>Package</b></td> <td style='border: 1px solid #333;text-align: left;padding: 8px;color:#333;'><b>".$plan_name."</b></td> </tr> <tr> <td style='border: 1px solid #333;text-align: left;padding: 8px;color:#333;'><b>Amount</b></td> <td style='border: 1px solid #333;text-align: left;padding: 8px;color:#333;'><b>₹ ".$amount."</b></td> </tr> </table> <p style='color:#333;'>Thanks & Regards,</p> <p style='color:#333;font-size:20px;'><b>R2G</b></p></div>"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1'."\r\n"; $headers .= 'From:'.$from."\r\n"; @mail($email,$subject,$message,$headers); //userEmail ?> <div class="page-wrap ne-aft-log"> <div class="container-fluid register-main ne-aft-log-tp"> <div class="row"> <?php include('breadcrumb.php');?> <div class="xxl-12 xxl-margin-left-2 xl-12 xl-margin-left-2 xs-16 xs-margin-left-0 s-16 xs-margin-left-0 m-16 m-margin-left-0 l-16 l-margin-left-0 margin-top-10px padding-15px ne-pre-success"> <div class="center-text font-green xxl-16 xl-16 l-16 m-16 s-16 xs-16"> <div class="row-10"> <div> <img src="img/tick_cancel.png" class="sucessTick"> </div> <div class="paymentSucess">Your payment is failed</div> </div> </div> <div class="clearfix"></div> <div class="text-center fail"> Your order status is "<?php echo $status;?>" </div> <div class="clearfix"></div> <div class="clearfix"></div> </div> <div class="clearfix"></div> </div> </div> </div>