-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbetaling_met_paypal.php
320 lines (270 loc) · 14.8 KB
/
betaling_met_paypal.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
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
<?php
include('configuratie/configuratie.php');
include('includes/plug.php');
include('includes/doctype.php');
if(isset($_SESSION['recup'])) {header("Location: caddie.php"); exit;}
include("includes/lang/lang_".$_SESSION['lang'].".php");
$title = "PAYPAL";
$displayPayments = 0;
if(!isset($_GET['add'])) {
$dateNow = date("Y-m-d H:i:s");
$paymentMode = "pp";
$query = mysql_query("SELECT users_password, users_nic
FROM users_orders
WHERE users_password = '".$_SESSION['clientPassword']."'
AND users_nic = '".$_SESSION['clientNic']."'");
$rows = mysql_num_rows($query);
if($rows == 0) {
if(!isset($_SESSION['devisNumero'])) {$_devis = "";} else {$_devis = $_SESSION['devisNumero'];}
if(!isset($_SESSION['accountRemiseEffec'])) {$accountRemiseEffecBd = "0.00";} else {$accountRemiseEffecBd = $_SESSION['accountRemiseEffec'];}
if(!isset($_SESSION['coupon_name'])) {$couponN = "";} else {$couponN = $_SESSION['coupon_name'];}
if(!isset($_SESSION['montantRemise2'])) {$couponC = "0.00";} else {$couponC = $_SESSION['montantRemise2'];}
if(!isset($_SESSION['montantRemise'])) {$couponC1 = "0.00";} else {$couponC1 = $_SESSION['montantRemise'];}
if(!isset($_SESSION['users_coupon_note'])) {$users_coupon_note = "";} else {$users_coupon_note = $_SESSION['users_coupon_note'];}
if(!isset($_SESSION['users_remise_note'])) {$users_remise_note = "";} else {$users_remise_note =$_SESSION['users_remise_note'];}
if(!isset($_SESSION['users_account_remise_note'])) {$users_account_remise_note = "";} else {$users_account_remise_note =$_SESSION['users_account_remise_note'];}
if(!isset($_SESSION['users_shipping_note'])) {$users_shipping_note = "";} else {$users_shipping_note =$_SESSION['users_shipping_note'];}
if(!isset($_SESSION['cadeau_number'])) {$_gc = "";} else {$_gc = $_SESSION['cadeau_number'];}
if(!isset($_SESSION['montantRemise3'])) {$gcAmount = "0.00";} else {$gcAmount = $_SESSION['montantRemise3'];}
if(isset($_SESSION['multipleTax'])) {$mTax = $_SESSION['multipleTax'];} else {$mTax = "";}
if($_SERVER['REMOTE_ADDR']) {$ipAddress=$_SERVER['REMOTE_ADDR'];} else {$ipAddress='';}
if(!isset($_SESSION['affiliateNumber'])) {
$usersAffNumber = "";
$usersAffAmount = 0;
}
else {
$usersAffNumber = $_SESSION['affiliateNumber'];
$usersAffAmount = $_SESSION['totalHtFinal']*($_SESSION['affiliateCom']/100);
}
if(isset($_SESSION['deee'])) {
$splitDeee = explode(",",$_SESSION['list']);
foreach ($splitDeee as $item) {
$checkDeee = explode("+",$item);
if($taxePosition=="Tax included") {
$priceTTCDeee = $checkDeee[7] * $checkDeee[1];
$deeeHt = $priceTTCDeee*100/($checkDeee[5]+100);
$deeeTax = $deeeHt * ($checkDeee[5]/100);
}
if($taxePosition=="Plus tax") {
$deeeHt = $checkDeee[7] * $checkDeee[1];
$deeeTax = $deeeHt * ($checkDeee[5]/100);
}
if($taxePosition=="No tax") {
$deeeHt = $checkDeee[7] * $checkDeee[1];
$deeeTax = 0;
}
$deeeHtArray[] = $deeeHt;
$deeeTaxArray[] = $deeeTax;
}
$deeeHtFinal = sprintf("%0.2f",array_sum($deeeHtArray));
$deeeTaxFinal = sprintf("%0.2f",array_sum($deeeTaxArray));
}
else {
$deeeHtFinal = sprintf("%0.2f",0);
$deeeTaxFinal = sprintf("%0.2f",0);
}
mysql_query("INSERT INTO users_orders
(users_gender,users_firstname,users_lastname,users_company,
users_address,users_zip,users_city,
users_surburb,users_province,users_country,users_date_added,
users_email,users_telephone,users_fax,
users_password,users_nic,users_payment,users_symbol_devise,
users_products,users_products_weight,
users_products_weight_price,users_total_to_pay,users_shipping_price,
users_ship_ht,users_ship_tax,users_products_ht,
users_products_tax,users_products_tax_statut,users_payed,users_statut,users_comment,
users_remise,users_remise_coupon,users_remise_coupon_name,
users_lang,users_save_data_from_form,users_coupon_note,users_remise_note,
users_shipping_note,users_account_remise_note,users_account_remise_app,
users_facture_adresse,users_affiliate,users_affiliate_amount,
users_devis, users_gc, users_remise_gc,
users_multiple_tax, users_deee_ht, users_deee_tax,
users_sup_ttc, users_sup_ht, users_sup_tax,
users_ip, users_shipping)
VALUES
('".$_SESSION['clientGender']."','".$_SESSION['clientFirstname']."','".$_SESSION['clientLastname']."','".$_SESSION['clientCompany']."',
'".$_SESSION['clientStreetAddress']."','".$_SESSION['clientPostCode']."','".$_SESSION['clientCity']."',
'".$_SESSION['clientSurburb']."','".$_SESSION['clientProvince']."','".$_SESSION['clientCountry']."','".$dateNow."',
'".$_SESSION['clientEmail']."','".$_SESSION['clientTelephone']."','".$_SESSION['clientFax']."',
'".$_SESSION['clientPassword']."','".$_SESSION['clientNic']."','".$paymentMode."','".$symbolDevise."',
'".$_SESSION['list']."','".$_SESSION['poids']."',
'".$_SESSION['shipPrice']."','".$_SESSION['totalToPayTTC']."','".$_SESSION['users_shipping_price']."',
'".$_SESSION['livraisonhors']."','".$_SESSION['shipTax']."','".$_SESSION['totalHtFinal']."',
'".$_SESSION['itemTax']."','".$_SESSION['taxStatut']."','no','no','".$_SESSION['clientComment']."',
'".$couponC1."','".$couponC."','".$couponN."',
'".$_SESSION['lang']."','".$_SESSION['saveDataFromForm']."','".$users_coupon_note."','".$users_remise_note."',
'".$users_shipping_note."','".$users_account_remise_note."','".$accountRemiseEffecBd."',
'".$_SESSION['fact_adresse']."','".$usersAffNumber."','".$usersAffAmount."',
'".$_devis."', '".$_gc."', '".$gcAmount."',
'".$mTax."', '".$deeeHtFinal."', '".$deeeTaxFinal."',
'".$_SESSION['priceEmballageTTC']."', '".$_SESSION['totalEmballageHt']."', '".$_SESSION['totalEmballageTva']."',
'".$ipAddress."', '".$_SESSION['shippingId']."'
)");
$splitUp = explode(",",$_SESSION['list']);
foreach ($splitUp as $item) {
$check = explode("+",$item);
if($check[3]=="GC100") {$gc[]=$check[2];} else {$gc[]=0;} // Contrôle cheque cadeau dans la commande
}
$arrGc = array_sum($gc);
if($arrGc> 0) {
$str1 = 'ABCDEFGHIJKLMNPQRSTUVWXYZ123456789';
$codeGc = '';
for( $i = 0; $i < 12 ; $i++ ) {
$codeGc .= substr($str1, rand(0, strlen($str1) - 1), 1);
}
$nextYear = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d"), date("Y")+1));
mysql_query("INSERT INTO gc
(gc_number,
gc_start,
gc_end,
gc_nic,
gc_amount
)
VALUES
('".$codeGc."',
'".$dateNow."',
'".$nextYear."',
'".$_SESSION['clientNic']."',
'".$arrGc."'
)");
mysql_query("UPDATE users_orders SET users_gc='".$codeGc."' WHERE users_nic = '".$_SESSION['clientNic']."'");
}
}
else {
// Mettre à jour le mode de paiement
mysql_query("UPDATE users_orders SET users_payment='pp' WHERE users_nic = '".$_SESSION['clientNic']."' AND users_password = '".$_SESSION['clientPassword']."'");
}
}
?>
<html>
<head>
<?php include('includes/hoofding.php');?>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table height="100%" width="<?php print $_SESSION['storeWidthUser'];?>" align="center" border="0" cellpadding="<?php print $cellpad;?>" cellspacing="0" class="TABLEBackgroundBoutiqueCentre"><tr>
<td width="1" class="borderLeft"></td><td valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="backGroundTop">
<tr height="<?php print $cellTop;?>" valign="top" >
<?php
if(isset($logo) AND $logo!=="noPath") {
print "<td align='left' valign='middle'>";
$largeurLogo = getimagesize($logo);
$logoWidth = $largeurLogo[0];
$widthMaxLogo = 160;
if($logoWidth>$widthMaxLogo) {
$logoRezise = $largeurLogo[0]/$largeurLogo[1];
$wwww=$widthMaxLogo;
$hhhh=$widthMaxLogo/$logoRezise;
$logoWidth = $wwww;
}
else {
$wwww=0;
$hhhh=0;
$logoWidth = $largeurLogo[0];
}
print detectIm($logo,$wwww,$hhhh);
print "</td>";
}
else {
if(isset($logo2) AND $logo2!=="noPath") {
print "<td valign='middle' align='center'>";
if($urlLogo2!=="") print "<a href='http://www.".$urlLogo2."'>".detectIm($logo2,0,0)."</a>"; else print detectIm($logo2,0,0);
print "</td>";
}
}
?>
</tr>
<tr>
<td colspan="3" >
<table width="99%" align="center" border="0" cellspacing="0" cellpadding="5" class="TABLEMenuPathTopPageMenuTabOff">
<tr height="32">
<td><b><img src="im/accueil.gif" align="TEXTTOP"> <a href="cataloog.php" ><?php print maj(HOME);?></a> | PAYPAL |</b>
</td>
</tr>
</table>
</td>
</tr>
<tr valign="top">
<td colspan="3">
<br>
<table align="center" height="100%" border="0" cellpadding="0" cellspacing="5" class="TABLEPageCentreProducts">
<tr>
<td valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="3" align="center">
<tr>
<td valign="top" align="left">
<table width="500" align="center" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<?php
if(!isset($_GET['add'])) {
display_payment_process(4,"");
}
?>
</td>
</tr></table>
<?php
if(!isset($_GET['add'])) {
include('includes/plug.inc.php');
print invoice_display($_SESSION['clientCountry'],"TABLE1","",$_SESSION['shippingId']);
}
print "<br>";
print "<table width='500' border='0' cellspacing='3' cellpadding='0' align='center' class='TABLE1'>";
print "<tr><td>";
print "<u><b>".PAIEMENT." via Paypal</b></u><br><br>";
print VOUS_AVEZ_CHOISI." <b>".$_SESSION['clientEmail']."</b>.<br>".VOUS_AVEZ_CHOISI2;
if($_SESSION['lang']==1) $lc = "FR";
if($_SESSION['lang']==2) $lc = "EN";
if($_SESSION['lang']==3) $lc = "NL";
$adress2 = explode("|",$_SESSION['fact_adresse']);
$extractClientName = explode(" ",$adress2[0]);
$nom = $extractClientName[0];
$prenom = $extractClientName[1];
$compagnie = $adress2[1];
$adresse1 = $adress2[2];
$adresse2 = $adress2[3];
$codePostal = $adress2[4];
$ville = $adress2[5];
$pays = $adress2[6];
print "<table width='100%' border='0' cellpadding='0' cellspacing='5'><tr>";
print "<form action='https://www.paypal.com/cgi-bin/webscr' method='post'>";
print "<td>";
print "<input type='hidden' name='cmd' value='_xclick'>";
print "<input type='hidden' name='business' value='".$paypalEmail."'>";
print "<input type='hidden' name='notify_url' value='http://".$www2.$domaineFull."/paypal/ipn.php'>";
print "<input type='hidden' name='item_name' value='".$_SESSION['clientNic']."'>";
print "<input type='hidden' name='currency_code' value='".$paypalDevise."'>";
print "<input type='hidden' name='amount' value='".$_SESSION['totalToPayTTC']."'>";
print "<input type='hidden' name='return' value='".$paypalReturn."'>";
print "<input type='hidden' name='rm' value='2'>";
print "<input type='hidden' name='bn' value='FR_boutikone_STD'>";
print "<input type='hidden' name='lc' value='".$lc."'>";
print "<input type='hidden' name='cancel_return' value='http://".$www2.$domaineFull."'>";
print "<input type='hidden' name='first_name' value='".$prenom."'>";
print "<input type='hidden' name='last_name' value='".$nom."'>";
print "<input type='hidden' name='email' value='".$_SESSION['clientEmail']."'>";
print "<input type='hidden' name='address1' value='".$adresse1."'>";
print "<input type='hidden' name='address2' value='".$adresse2."'>";
print "<input type='hidden' name='city' value='".$ville."'>";
print "<input type='hidden' name='state' value='".$pays."'>";
print "<input type='hidden' name='zip' value='".$codePostal."'>";
print "<input style='BACKGROUND: none; border:0px' type='image' src='im/paypal.gif' title='".PAIEMENT." via Paypal' name='submit' value='".PAIEMENT." via Paypal' name='submit'>";
print "</td>";
print "</form>";
print "</tr>";
print "</table>";
print "</td></tr></table>";
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td></tr></table>
<?php include("includes/footer.php");?>
</td>
<td width="1" class="borderLeft"></td>
</tr></table>
</body>
</html>