-
Notifications
You must be signed in to change notification settings - Fork 13
/
order_pay.php
47 lines (34 loc) · 933 Bytes
/
order_pay.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
<?php
require_once('includes/header.php');
require_once('includes/order.lib.php');
$oid = (int)@$_POST['id'];
/// 先检查这个订单是不是已经支付过了
$orders = db_quick_fetch('order', "WHERE id=$oid");
if (count($orders) <= 0) {
pay_error('No such order');
die();
}
$order = $orders[0];
if ($order['paidtime'] != null) {
$smarty->assign('tip_title', _('Error'));
$smarty->assign('tip_msg', _('This order is already paid'));
$smarty->assign('redirect_url', $url);
$smarty->assign('redirect_delay', 1);
$smarty->display('tip.html');
die();
}
/// 生成订单并跳转到支付页面
$order = order_request($oid);
if ($order === false) {
pay_error(_('An error occured, please contact us for help'));
die();
}
order_redirect($oid);
function pay_error($msg) {
global $smarty;
$smarty->assign(array('tip_title' => _('ERROR'),
'tip_msg' => _($msg)
));
$smarty->display('tip.html');
}
?>