-
Notifications
You must be signed in to change notification settings - Fork 2
/
success.php
73 lines (55 loc) · 1.95 KB
/
success.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
session_start();
include 'config.php';
include 'db_config.php';
$session_token = $_SESSION['token'];
$token = $_REQUEST['cm'];
$tamp_payment = $db->query("SELECT * from temp_payments where token='".$token."'");
$row = $tamp_payment->fetch_array(MYSQLI_ASSOC);
if($tamp_payment->num_rows && $row['token']==$session_token){
$item_no = $_REQUEST['item_number'];
$item_transaction = $_REQUEST['tx']; // Paypal transaction ID
$item_price = $row['amount']; // Paypal received amount
$item_currency = $_REQUEST['cc']; // Paypal received currency type
$payment_status = $_GET['st'];
$created_date = date('Y-m-d H:i:s');
$tamp_payment = $db->query("SELECT * from payments where txn_id='".$item_transaction."'");
if(empty($tamp_payment->num_rows)){
$insert = $db->query("INSERT INTO payments(item_number,txn_id,payment_gross,currency_code,payment_status,created_date) VALUES('".$item_no."','".$item_transaction."','".$item_price."','".$item_currency."','".$payment_status."','".$created_date."')");
$last_insert_id = $db->insert_id;
$to = $row['email'];
$subject = "Payment Successful With Txn Id#$item_transaction";
$txt = "Thanks For Payment of $item_currency $item_price.";
$headers = "From: $mail_from" . "\r\n" .
"CC: $mail_cc";
mail($to,$subject,$txt,$headers);
}
?>
<html>
<body style="background-color:#EBEFF2">
<table align="center" border="0" height="100%" style="padding:220px">
<tr align="center">
<td colspan="3" style="font-size:30px"><b>Thank you for Shopping</b></td>
</tr>
<tr>
<td><b>Your transaction ID</b></td>
<td> : </td>
<td><?php echo $item_transaction; ?> </td>
</tr>
<tr>
<td><b>Amount</b></td>
<td>: </td>
<td><?php echo $item_price; ?> <?php $item_currency ?></td>
</tr>
</table>
</body>
</html>
<?php
}else{ ?>
<html>
<body style="background:snow">
<h1 style="color:red;text-align:center"><strong>Token Mismatch Error... Something Is Wrong... </strong></h1><br>
</body>
</html>
<?php }
?>