-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfirmation.php
238 lines (202 loc) · 7.33 KB
/
confirmation.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
<?php
if($_REQUEST['orderString'] == NULL) {
header("Location: /");
}
$couponcode = strtoupper(urlencode($_REQUEST['orderCoupon']));
header("Cache-Control: no-cache, private, must-revalidate, max-age=0");
header("Pragma: no-cache");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // A date in the past
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
$timeStr = date('Y/m/d g:i:s A');
$messageAlphaDelta = $timeStr . "\n\n" . str_replace("*","\n", $_REQUEST['orderString']);
$messageAlphaDelta = str_replace("<i>", "", $messageAlphaDelta);
$messageAlphaDelta = str_replace("</i>", "", $messageAlphaDelta);
//$messageAlphaDelta = $messageAlphaDelta. "\n Credit: " . ($_REQUEST['ordercredit'] == "ON");
$headerAlphaDelta = "From: " . "[email protected]";
$subjectStr = "Subject: Incoming Order From: OneButtonWenzel.com ". $timeStr;
//echo "THE CREDIT INFO IS":
//echo $_REQUEST['ordercredit'];
//if($_REQUEST['ordercredit']=='Yes') {
//}
//else {
/*
if ($couponcode == "YALIESLOVEWENZELS") {
$messageAlphaDelta .= 'COUPON CODE: 20% OFF';
}
else if ($couponcode == "PROVOSTSALIVATE") {
$messageAlphaDelta .= 'COUPON CODE: 15% OFF';
}
*/
if ($couponcode == "LOVEMOM") {
$messageAlphaDelta .= 'COUPON CODE: 100% OFF (FREE)';
}
if(strstr($_REQUEST['orderString'], "Cash")) {
//mail("[email protected]", $subjectStr, $messageAlphaDelta, $headerAlphaDelta);
}
//}
?>
<head>
<title>Order Confirmation</title>
<link rel="stylesheet" type="text/css" href="main.css" />
</head>
<form action="https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/910190858844300" id="googleform" method="post" name="googleForm" target="_top">
<input name="_charset_" type="hidden" value="utf-8"/>
</form>
<body onload="load();">
<div class="main-content" id="confirm-wrapper">
<h3>You've been WENZELED!</h3>
<div id="confirmation">
</div>
<div id='bottom-message'>
<br/><br>
For updates on your order, please call Alpha Delta: <b>(203) 309-0549</b>
<br/><br><br>
To reach One Button Wenzel, <a href="/about.php">message us</a> or call: <b>(213) 2 WENZEL</b>
</div>
</div>
</body>
</html>
<script type="text/javascript">
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function eraseCookie(name) {
createCookie(name,"",-1);
}
function load() {
<?php
$asscrack = 1.0;
/*
if ($couponcode == "YALIESLOVEWENZELS") {
$asscrack = .8;
}
else if ($couponcode == "PROVOSTSALIVATE") {
$asscrack = .85;
}
*/
if ($couponcode == "LOVEMOM") {
$asscrack = 0;
}
echo "var dicks = $asscrack;";
if ($asscrack < 1) {
$adjust = 100 - $asscrack * 100;
echo "var gotcoupon = 'Coupon for $adjust% off';";
}
else {
echo "var gotcoupon = undefined;";
}
?>
if(readCookie("redirect")) {
document.location.href = "/";
}
form = document.getElementById("googleform");
if(readCookie("ordercredit")) {
//populate and submit the google check out form
var googleCount = 1;
var wenzelArr = new Array();
var wenzelCounts = new Array();
if(readCookie("curCount")) {
var countStr = readCookie("curCount");
wenzelCounts = countStr.split('a');
}
if(readCookie("curOrder")) {
var orderStr = readCookie("curOrder");
wenzelArr = orderStr.split('{');
}
var totalCost = 0;
var totalCostBeforeCoupon = 0;
for(var i = 0; i < wenzelArr.length; i++) {
var count = wenzelCounts[i];
if(count > 0) {
var curCost = 8.75;
if(wenzelArr[i].indexOf("blue cheese") != -1) {
curCost = curCost + 0.5;
}
if (wenzelArr[i].indexOf("ranch") != -1) {
curCost = curCost + 0.5;
}
if (wenzelArr[i].indexOf("bacon") != -1) {
curCost = curCost + 1.0;
}
if (wenzelArr[i].indexOf("fries") != -1) {
curCost = curCost + 2.0;
}
if (wenzelArr[i].indexOf("Pinny") != -1) {
curCost = curCost + 5.0;
}
var cost = curCost*dicks;
totalCost += cost*count;
totalCostBeforeCoupon = curCost * count;
form.innerHTML = form.innerHTML +
"<input name=\"item_name_" + googleCount + "\" type=\"hidden\"" +
" value=\"" + wenzelArr[i] + "\"/>" +
"<input name=\"item_description_" + googleCount + "\" type=\"hidden\" value=\"\"/>" +
"<input name=\"item_quantity_" + googleCount + "\" type=\"hidden\" value=\"" + count + "\"/>" +
"<input name=\"item_price_" + googleCount + "\" type=\"hidden\" value=\"" + cost + "\"/>" +
"<input name=\"item_currency_" + googleCount + "\" type=\"hidden\" value=\"USD\"/>";
googleCount++;
}
}
form.innerHTML = form.innerHTML +
"<input name=\"item_name_" + googleCount + "\" type=\"hidden\"" +
" value=\"Delivery To: " + readCookie("address") + "\"/>" +
"<input name=\"item_description_" + googleCount + "\" type=\"hidden\" value=\"" + readCookie("phone") + "\"/>" +
"<input name=\"item_quantity_" + googleCount + "\" type=\"hidden\" value=\"" + 1 + "\"/>" +
"<input name=\"item_price_" + googleCount + "\" type=\"hidden\" value=\"" + 0 + "\"/>" +
"<input name=\"item_currency_" + googleCount + "\" type=\"hidden\" value=\"USD\"/>";
googleCount++;
if (gotcoupon) {
form.innerHTML = form.innerHTML +
"<input name=\"item_name_" + googleCount + "\" type=\"hidden\"" +
" value=\"Coupon: " + gotcoupon + "\"/>" +
"<input name=\"item_description_" + googleCount + "\" type=\"hidden\" value=\"" + gotcoupon + "\"/>" +
"<input name=\"item_quantity_" + googleCount + "\" type=\"hidden\" value=\"" + 1 + "\"/>" +
"<input name=\"item_price_" + googleCount + "\" type=\"hidden\" value=\"" + 0 + "\"/>" +
"<input name=\"item_currency_" + googleCount + "\" type=\"hidden\" value=\"USD\"/>";
googleCount++;
}
var tipAmount = readCookie('tipamount');
//alert(tipAmount);
tipAmount = (tipAmount/100);
//alert(tipAmount);
tipAmount = tipAmount * totalCostBeforeCoupon;
//alert(tipAmount);
// alert(tipAmount);
form.innerHTML = form.innerHTML +
"<input name=\"item_name_" + googleCount + "\" type=\"hidden\"" +
" value=\"Tip:\"/>" +
"<input name=\"item_description_" + googleCount + "\" type=\"hidden\" value=\"\"/>" +
"<input name=\"item_quantity_" + googleCount + "\" type=\"hidden\" value=\"" + 1 + "\"/>" +
"<input name=\"item_price_" + googleCount + "\" type=\"hidden\" value=\"" + tipAmount + "\"/>" +
"<input name=\"item_currency_" + googleCount + "\" type=\"hidden\" value=\"USD\"/>";
eraseCookie("ordercredit");
createCookie("redirect", 1, 1);
form.submit();
}
var confStr = readCookie("confString");
//var adStr = readCookie("adString");
//alert(confStr);
document.getElementById("confirmation").innerHTML = document.getElementById("confirmation").innerHTML
+ confStr;
}
</script>