-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathverify.php
42 lines (35 loc) · 1.17 KB
/
verify.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
<?php
require 'inc/common.php';
require 'inc/mailer.php';
require 'inc/db.php';
$paymentid = (int)$_GET['id'];
$ok = (int)$_GET['ok'];
$email = urldecode($_GET['email']);
$email2 = $link->escapeString($email);
$result = $link->query("SELECT email,amount FROM Payments WHERE id = $paymentid;")
or die('link->query SELECT error');
if ($row = $result->fetchArray())
$amount = $row['amount'];
if ($amount == '100')
$months = 1;
else if ($amount == '450')
$months = 6;
else if ($amount == '900')
$months = 12;
else if ($amount == '5000')
$months = 12;
else
mail_and_die('wrong amount', __FILE__);
$link->exec("UPDATE Payments SET verified = $ok WHERE id = $paymentid")
or mail_and_die('link->exec UPDATE Payments error', __FILE__);
if ($ok) {
$link->exec("UPDATE Users SET paid_verified = (SELECT submitted FROM Payments WHERE id = $paymentid) + INTERNAL $months MONTH WHERE email = '$email2'")
or mail_and_die('link->exec UPDATE Users error', __FILE__);
}
else {
$link->exec("UPDATE Users SET paid = DATE(paid, '-$months MONTH') WHERE email = '$email2'")
or mail_and_die('link->exec UPDATE Users error', __FILE__);
//mailer($email, $subject, $body);
}
$link->close();
unset($link);