This repository was archived by the owner on Feb 7, 2025. It is now read-only.
forked from jwnisbet/melodiesforus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpurchase.php
More file actions
executable file
·309 lines (257 loc) · 10.4 KB
/
purchase.php
File metadata and controls
executable file
·309 lines (257 loc) · 10.4 KB
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
<?php
//This is the post-transaction offer page.
// start session
session_start();
include_once('functions.php');
$sid = intval($_COOKIE['sid']);
if(array_key_exists('pre_email', $_REQUEST)) {
$email = htmlentities($_REQUEST['pre_email'], ENT_QUOTES);
if(USE_MTURK) {
$mturk_id = htmlentities($_REQUEST['pre_mturk_id'], ENT_QUOTES);
}
else {
$mturk_id = false;
}
$age = intval($_REQUEST['pre_age']);
$songId = intval($_REQUEST['songId']);
$zip = ''.intval($_REQUEST['pre_zip']);
edit_session(array('pre_email'=>$email, 'sid'=>$sid, 'pre_zip'=>$zip, 'pre_mturk_id'=>$mturk_id,'pre_age'=>$age, 'songId'=>intval($_REQUEST['songId'])), false, 'pre');
}
else {
$email = get_from_session($sid,'pre_email');
$songId = get_from_session($sid,'songId', true);
}
//include_once('redirector.php');
//get the treatment and its properties for the current session
$treatment = getTreatmentForSession($sid);
$box_value = '';
// get $opt and $prepop based on code
$group_code = $_SESSION['group_code'];
// get $opt from code
$opt = getOptionFromCode($group_code);
// get prepop from code
$prepop = getPrepopFromCode($group_code);
if ($prepop == 'fill') {
$box_value = htmlentities($email, ENT_QUOTES);
}
$box_display = 'block';
$box_hidden = false;
if($prepop == 'yes-hidden') {
$box_display = 'none';
$box_hidden = true;
}
$wt = $treatment['warning_type'];
$warning_msg = $treatment['warning_msg'];
//shows interstitial warnings
function showInterstitial() {
global $warning_msg, $wt;
$toExec = '$("#interstitial").hide();logEvent("interstitial", "hide");';
?>
<div id='interstitial' style='position:absolute;left:0;top:0;width:100%;height:100%;text-align:center;background-color:white;display:table'>
<div style='display:inline-block;margin:0 auto;display:table-cell;vertical-align:middle'>
<center>
<div style='border: 3px solid black;padding:10px;height: 150px; width:500px'>
<?php echo $warning_msg;
if($wt == 'interstitial_button') {
echo "<br><button id='hide_interstitial_btn' style='margin-top:30px;height:50px;width:75px' onclick='$toExec'>Okay</button>";
}
else { //interstitial_timer_[long/short]
$length = str_replace('interstitial_timer_','',$wt);
$waitTime = 10000; //10 secs
if($length == 'short') {
$waitTime = 5000; //5 secs
}
echo "<script>setTimeout('$toExec', $waitTime);</script>";
}
?>
</div>
</center>
</div>
</div>
<?php
}
if($wt != 'checkout' && $wt != 'none') {
showInterstitial();
}
?>
<script src="./assets/js/jquery.js"></script>
<script src="./eventRecorder.js"></script>
<script type="text/javascript" src="./survey/js/jquery.validate.js"></script>
<link href="./assets/css/bootstrap.css" rel="stylesheet">
<script>
function next(yesno) {
opt = '<?php echo $opt; ?>';
mediaId = <?php echo $songId;?>
logEvent('opt_'+ opt +'_btn', 'opt_'+ opt + '=' + yesno, false);
sendEmail = false;
// if opt == out, user needs to 'opt out' of the delivery system
// if opt == in, user needs to 'opt in' to the delivery system
if(yesno == 'no') { //clicked no btn
if (opt == 'out') {
// User wants email to be sent to them
sendEmail = true;
}
} else { //clicked big yes btn
if(opt == 'in') {
// // User wants email to be sent to them
sendEmail = true;
}
}
post_email = $('#post_email').val();
// alert("Send = " + sendEmail + "\nMedia Id = " + mediaId);
window.location = 'looper.php?sendEmail=' + sendEmail + '&post_email=' + post_email + '&mediaId='+ mediaId;
}
</script>
<!-- use this iframe to start the download -->
<?php
$paths = get_media_path($songId);
$mediaPath = "";
if($paths) {
$mediaPath = $paths[0]["zip_path"];
}
?>
<iframe width=1 height=1 style='display:none' src='<?php echo $mediaPath; ?>'></iframe>
<body>
<!--<p>Code: <?php echo $group_code ?></p>
<p>Option: <?php echo $opt ?></p>
<p>Pre: <?php echo $prepop ?></p>-->
<div class="purchasePage_Container">
<div class='row'>
<div class='span13'>
<p class='purchasePage_orderConf'>
<span>Thank you!</span> WebMed.ia has processed your order.
</p>
<!--Replaced table with divs, easier to deal with, less code-->
<div class='purchasePage_SafeDeliveryDiv'>
<h2 class='safeDelivery_heading'>Get your purchase sent to you safely and securely with SafeDelivery</h2>
<div class='safeDelivery_Info'>
<div>
<p class='safeDelivery_servicesHeading'>SafeDelivery offers you the following services:</p>
<ul class='safeDelivery_services'>
<li>Extra security for your media delivery.</li>
<li>An additional way to access your media.</li>
<li><span style="text-decoration: underline;">SAVE 50% </span> when your media is delivered by email.</li>
</ul>
</div>
<img src="./assets/img/woman.jpg" border="0" alt="Woman " title="Woman" width="195" height="150" style="float: right;" />
</div>
</div>
<!--Removed second table, created series of divs instead-->
<div class='purchasePage_emailAndConditionsDiv'>
<div class='emailAndConditionsDiv_leftSide'>
<div class='leftSide_topContainer'>
<!--put all email validation forms and such in this div -->
<div class='leftSide_currentSafeDeliverySettings'>
<!--Informs user of SafeDelivery choice-->
<?php
$start_text = 'Entering your email address ';
$end_text = 'automatically charge your budget according to the Offer Details to the right';
if($box_hidden || $prepop != 'no') {
$start_text = 'Clicking the button ';
}
if($opt == 'out') {
$start_text = 'You are subscribed to the SafeDelivery service. ' . $start_text;
$end_text = 'remove you from the SafeDelivery service described to the right';
}
echo "<p>$start_text below constitutes your electronic signature and we will $end_text.</p>";
?>
</div>
<div class='leftSide_emailValidationForm'>
<!--Email validation form-->
<form id='post_email_form'>
<p style="text-align: center;">
<span style='display:<?php echo $box_display; ?>'>
E-mail Address:
<input type='text' id='post_email' class='input-block-level' style='margin-top:5px;width:85%' placeholder='Email Address' value='<?php echo $box_value; ?>' name='post_email' />
</span>
<style>
input.error, select.error {
background: #FFC;
}
label.error {
display:none;
}
</style>
<?php
$button_text = 'Email media';
if($opt == 'out') {
// the user needs to 'opt out' of the delivery system
$button_text = 'Remove me from SafeDelivery';
}
echo "<a href='#' id='submitBtn' class='btn btn-large' style='font-family:times;width:75%' onclick='do_validation()' type='submit'>$button_text</a>";
?>
<script>
function do_validation() {
if($("#post_email").valid() == '1') {
next("yes");
<?php $yesno = 'yes'; ?>
}
}
function say_no() {
next("no");
<?php $yesno = 'no';?>
}
$('#post_email_form').validate({
rules: {
post_email: {
required: true,
email: true
}
}
});
</script>
<br/><br/>
<a href='#' onclick='say_no()'>No thanks</a>
</p>
</form>
</div>
</div>
<h3 class='leftSide_UserBank'>User Bank: $0.51</h3>
</div>
<div class='emailAndConditionsDiv_rightSide'>
<!--Put all terms and conditions in this div-->
<p class='safeDelivery_servicesHeading'>SafeDelivery Details:</p>
<p>
SafeDelivery is a trustworthy provider for digital communications and the delivery of digital content.
This service is offered by leading online music retailers to ensure that customers get the music they
want without problems. There are many benefits of using SafeDelivery.
</p>
<ul>
<li>
If you lose your original copy of the media, you will always have a second copy available.
</li>
<li>
You save 50% when ordering the delivery of a copy of your media via SafeDelivery email.
</li>
<li>
We guarantee that the emailed copy is the same as the initial selection.
</li>
<li>
100% satisfaction guaranteed.
</li>
</ul>
<p class='safeDelivery_servicesHeading'>Offer Details:</p>
<?php
$start_text = 'type in your email address and ';
$pre_text = '';
if($box_hidden) {
$start_text = '';
}
if($opt == 'out') {
$pre_text = 'You have been subscribed to the SafeDelivery service.';
$button_text = 'No thanks';
}
echo "<p>".$pre_text." Simply ".$start_text."click \"$button_text\" to use our services and to take
advantage of the great value that SafeDelivery provides. By clicking \"$button_text\" you will
receive a safe email copy of the identical item you selected in the WebMed.ia store for just $0.50.
This is a 50% DISCOUNT for the additional copy. You will SAVE an incredible $0.50 on this purchase.
When you agree to use SafeDelivery you will receive your WebMed.ia selection delivered in a timely
manner by email to your account. Your emailed backup copy of the item will help you to have
continued access to your media in case of data loss or when you are using different computers.
Alternative offers will not give you the same satisfaction or the same $0.50 DISCOUNT. Because of
this special reduced offer price we cannot offer any refunds. We always strive to serve our
customers to provide them with the quickest and most reliable mode of music delivery. Our customers
have the highest degree of satisfaction with SafeDelivery and we invite you to try our offer.</p>";
?>
</div>
</div>