/
/
home
/
u523034047
/
domains
/
airbuzz.co.in
/
public_html
Server: in-mum-web1112.main-hosting.eu (62.72.28.111)
You: 216.73.216.60
PHP 8.3.16
Dir:
/home/u523034047/domains/airbuzz.co.in/public_html
Edit:
/home/u523034047/domains/airbuzz.co.in/public_html/success.php
<?php include 'includes/config.php'; // PayU Credentials $MERCHANT_KEY = "YOUR_TEST_KEY"; $SALT = "YOUR_TEST_SALT"; $status = $_POST["status"]; $firstname = $_POST["firstname"]; $amount = $_POST["amount"]; $txnid = $_POST["txnid"]; $email = $_POST["email"]; $productinfo = $_POST["productinfo"]; $received_hash= $_POST["hash"]; // Reverse hash verify $hash_string = $SALT."|".$status."|||||||||||".$email."|".$firstname."|".$productinfo."|".$amount."|".$txnid."|".$MERCHANT_KEY; $calculated_hash = strtolower(hash("sha512", $hash_string)); if($calculated_hash != $received_hash){ die("Payment Verification Failed!"); } if($status == "success"){ // Generate Unique Voucher Code do{ $voucher_code = strtoupper(substr(md5(time().rand()),0,10)); $check = $conn->query("SELECT id FROM vouchers WHERE voucher_code='$voucher_code'"); }while($check->num_rows > 0); // Extract voucher id $voucher_id = str_replace("Voucher_","",$productinfo); // Expiry 6 months $expiry_date = date("Y-m-d", strtotime("+6 months")); // Insert into DB $stmt = $conn->prepare("INSERT INTO vouchers (txnid,voucher_id,user_email,voucher_code,amount,expiry_date,payment_status) VALUES (?,?,?,?,?,?,?)"); $payment_status = "Paid"; $stmt->bind_param("sissdss", $txnid, $voucher_id, $email, $voucher_code, $amount, $expiry_date, $payment_status ); $stmt->execute(); // HTML Email Template $subject = "Your Digital Gift Voucher Code 🎁"; $message = " <html> <body style='font-family:Poppins,Arial'> <div style='max-width:600px;margin:auto;padding:20px;border:1px solid #eee;border-radius:10px'> <h2 style='color:#4e73df;'>🎉 Payment Successful!</h2> <p>Thank you for your purchase.</p> <h3>Your Voucher Code:</h3> <div style='font-size:24px;font-weight:bold;color:#e74a3b;margin:10px 0;'> $voucher_code </div> <p><b>Amount:</b> ₹$amount</p> <p><b>Valid Till:</b> $expiry_date</p> <hr> <p style='font-size:12px;color:gray'> Please keep this code safe. It can be redeemed only once. </p> </div> </body> </html> "; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; $headers .= "From: no-reply@https://airbuzz.co.in"; mail($email, $subject, $message, $headers); ?> <!DOCTYPE html> <html> <head> <title>Payment Success</title> </head> <body style="font-family:Poppins;text-align:center;padding:50px;"> <h1>🎉 Payment Successful!</h1> <h2>Your Voucher Code:</h2> <div style="font-size:28px;font-weight:bold;color:#e74a3b;"> <?php echo $voucher_code; ?> </div> <p>Voucher also sent to your email.</p> <a href="index.php">Buy Another Voucher</a> </body> </html> <?php }else{ echo "Payment Failed!"; } ?>
Ukuran: 3.1 KB