-
Notifications
You must be signed in to change notification settings - Fork 56
/
process.htm
174 lines (166 loc) · 7.15 KB
/
process.htm
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<?
###############################################################################
# PROGRAM : EPAY ENTERPRISE #
# VERSION : 4.13 #
# AUTHOR : DMITRY PEREUDA #
# COMPANY : ALSTRASOFT #
# COPYRIGHTS : (C)2009 ALSTRASOFT. ALL RIGHTS RESERVED #
# COPYRIGHTS BY (C)2009 ALSTRASOFT. ALL RIGHTS RESERVDED #
# LICENSE KEY : C3FA-76A1-83A4-C2B4-AE1F-1D5A-14ED-1DCA #
###############################################################################
# THIS FILE IS PART OF EPAY SCRIPT - THE NEW UNIVERSAL PAYMENT GATEWAY #
# DEVELOPED BY ALSTRASOFT #
###############################################################################
# ALL SOURCE CODE, IMAGES, PROGRAMS, FILES INCLUDED IN THIS DISTRIBUTION #
# COPYRIGHTS BY (C)2009 ALSTRASOFT. ALL RIGHTS RESERVDED #
###############################################################################
# ANY REDISTRIBUTION WITHOUT PERMISSION OF ALSTRASOFT AND IS #
# STRICTLY FORBIDDEN #
###############################################################################
# COPYRIGHTS BY (C)2009 ALSTRASOFT. ALL RIGHTS RESERVDED #
###############################################################################
# COPYRIGHTS BY (C)2009 ALSTRASOFT. ALL RIGHTS RESERVDED #
###############################################################################
$data['PageName']='ORDER DETAILS';
$data['PageFile']='process';
$data['HideMenu']=true;
###############################################################################
include('config.htm');
###############################################################################
if(!$post['step']){
if($post['action']=='product'||$post['action']=='donation'||$post['action']=='subscription'){
$post['owner']=get_member_id($post['member']);
if(!$post['owner']){
header("Location:{$data['Host']}/index.htm");
echo('ACCESS DENIED.');
exit;
}
$product=select_product_details($post['product'], $post['owner']);
if(!$product){
header("Location:{$data['Host']}/index.htm");
echo('ACCESS DENIED.');
exit;
}
foreach($product as $key=>$value){
$_SESSION[$key]=$value;
$post[$key]=$value;
}
$_SESSION['pid']=$product['id'];
$_SESSION['product']=$product['name'];
$_SESSION['action']=$post['action'];
}elseif($post['action']=='payment'){
if(!$post['price']){
header("Location:{$data['Host']}/index.htm");
echo('ACCESS DENIED.');
exit;
}
foreach($data['FormParams'] as $value)$_SESSION[$value]=$post[$value];
$_SESSION['owner']=get_member_id($post['member']);
}else{
header("Location:{$data['Host']}/index.htm");
echo('ACCESS DENIED.');
exit;
}
if($data['UseTuringNumber'])$_SESSION['turing']=gencode();
if(!$_SESSION['quantity'])$_SESSION['quantity']=1;
$post['step']=1;
}
###############################################################################
if($post['back'])$post['step']--;
###############################################################################
if($post['step']==1){
foreach($data['FormParams'] as $value){
if($_SESSION[$value])$post[$value]=$_SESSION[$value];
}
if($_POST['price'])$post['price']=$_POST['price'];
$post['member']=get_member_username($post['owner']);
$post['status']=get_member_status_ex($post['owner']);
$post['total']=($post['price']+$post['setup']+$post['tax']+$post['shipping'])*$post['quantity'];
$_SESSION['total']=$post['total'];
if($post['send']){
unset($_SESSION['ufound']);
if($post['price']==0){
$data['Error']='Please enter valid sum for payment.';
}elseif($_SESSION['action']=='payment'&&
get_member_status($uid)<2&&$post['price']>$data['PaymentMaxSum']){
$data['Error']="Receiver cannot receive more than".
" {$data['Currency']}{$data['PaymentMaxSum']} per".
" transaction because she/he is UNVERIFIED member.";
}elseif(!$post['username']){
$data['Error']='Your username can not be empty.';
}elseif(!$post['password']){
$data['Error']='Your password can not be empty.';
}elseif($post['owner']==get_member_id($post['username'])){
$data['Error']='You cannot send money to yourself.';
}elseif($data['UseTuringNumber']&&
(!$post['turing']||strtoupper($post['turing'])!=$_SESSION['turing'])){
$data['Error']='Please enter valid turing number.';
}elseif(!is_member_active($post['username'], $post['password'])){
$data['Error']='This username is not found, inactive or banned.';
}elseif(!is_member_found($post['username'], $post['password'])){
$data['Error']='Your have entered a wrong username or password.';
}elseif($post['price']>select_balance(get_member_id($post['username']))){
$data['Error']='You do not have enough money in your account.';
}else{
$_SESSION['ufound']=true;
$_SESSION['buyer']=get_member_id($post['username'], $post['password']);
$post['step']++;
}
}
}elseif($post['step']==2){
if($_SESSION['ufound']){
if($_SESSION['action']=='product'||$_SESSION['action']=='donation'||$_SESSION['action']=='subscription'){
update_sold($_SESSION['pid'], $_SESSION['quantity']);
if($_SESSION['action']=='subscription')insert_subscription($_SESSION['owner'], $_SESSION['buyer'], $_SESSION['pid']);
}
$fees=($_SESSION['total']*$data['PaymentPercent']/100)+$data['PaymentFees'];
transaction(
$_SESSION['buyer'],
$_SESSION['owner'],
$_SESSION['total'],
$fees,
0,
1,
$post['notes']
);
$post['fees']=prnsumm($fees);
$post['buyer']=get_member_email($_SESSION['buyer']);
$post['amount']=prnsumm($_SESSION['total']);
$post['username']=get_member_username($_SESSION['buyer']);
$post['comments']=($post['notes']?$post['notes']:'N/A');
if($_SESSION['action']!='subscription'){
$post['email']=$post['buyer'];
send_email('PAYMENT-MONEY', $post);
$post['email']=get_member_email($_SESSION['owner']);
send_email('PAYMENT-MONEY-TO-OWNER', $post);
}else{
$post['email']=$post['buyer'];
send_email('SUBSCRIPTION-MONEY', $post);
$post['email']=get_member_email($_SESSION['owner']);
send_email('SUBSCRIPTION-MONEY-TO-OWNER', $post);
}
$back['pid']=$_SESSION['pid'];
$back['pname']=$_SESSION['product'];
$back['buyer']=get_member_username($_SESSION['buyer']);
$back['total']=$_SESSION['total'];
$back['action']=$_SESSION['action'];
$back['quantity']=$_SESSION['quantity'];
$back['comments']=$post['notes'];
$back['referer']=$data['Host'];
$unotify=$_SESSION['unotify'];
$ureturn=$_SESSION['ureturn'];
$ucancel=$_SESSION['ucancel'];
foreach($_SESSION as $key=>$value)unset($_SESSION[$key]);
session_destroy();
if($unotify)use_curl($unotify, $back);
if(!$ureturn)$ureturn="{$data['Host']}/index.htm";
if(!$ucancel)$ucancel="{$data['Host']}/index.htm";
header("Location:{$ureturn}");
echo('ACCESS DENIED.');
exit;
}
}
###############################################################################
display();
###############################################################################
?>