forked from hammadshahir/PHP-MySQL-ecommerce-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
footer.php
225 lines (201 loc) · 7.34 KB
/
footer.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
<?php
$statement = $pdo->prepare("SELECT * FROM tbl_settings WHERE id=1");
$statement->execute();
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as $row)
{
$footer_about = $row['footer_about'];
$contact_email = $row['contact_email'];
$contact_phone = $row['contact_phone'];
$contact_address = $row['contact_address'];
$footer_copyright = $row['footer_copyright'];
$total_recent_post_footer = $row['total_recent_post_footer'];
$total_popular_post_footer = $row['total_popular_post_footer'];
$newsletter_on_off = $row['newsletter_on_off'];
$before_body = $row['before_body'];
}
?>
<?php if($newsletter_on_off == 1): ?>
<section class="home-newsletter">
<div class="container">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<div class="single">
<?php
if(isset($_POST['form_subscribe']))
{
if(empty($_POST['email_subscribe']))
{
$valid = 0;
$error_message1 .= LANG_VALUE_131;
}
else
{
if (filter_var($_POST['email_subscribe'], FILTER_VALIDATE_EMAIL) === false)
{
$valid = 0;
$error_message1 .= LANG_VALUE_134;
}
else
{
$statement = $pdo->prepare("SELECT * FROM tbl_subscriber WHERE subs_email=?");
$statement->execute(array($_POST['email_subscribe']));
$total = $statement->rowCount();
if($total)
{
$valid = 0;
$error_message1 .= LANG_VALUE_147;
}
else
{
// Sending email to the requested subscriber for email confirmation
// Getting activation key to send via email. also it will be saved to database until user click on the activation link.
$key = md5(uniqid(rand(), true));
// Getting current date
$current_date = date('Y-m-d');
// Getting current date and time
$current_date_time = date('Y-m-d H:i:s');
// Inserting data into the database
$statement = $pdo->prepare("INSERT INTO tbl_subscriber (subs_email,subs_date,subs_date_time,subs_hash,subs_active) VALUES (?,?,?,?,?)");
$statement->execute(array($_POST['email_subscribe'],$current_date,$current_date_time,$key,0));
// Sending Confirmation Email
$to = $_POST['email_subscribe'];
$subject = 'Subscriber Email Confirmation';
// Getting the url of the verification link
$verification_url = BASE_URL.'verify.php?email='.$to.'&key='.$key;
$message = '
Thanks for your interest to subscribe our newsletter!<br><br>
Please click this link to confirm your subscription:
'.$verification_url.'<br><br>
This link will be active only for 24 hours.
';
$headers = 'From: ' . $contact_email . "\r\n" .
'Reply-To: ' . $contact_email . "\r\n" .
'X-Mailer: PHP/' . phpversion() . "\r\n" .
"MIME-Version: 1.0\r\n" .
"Content-Type: text/html; charset=ISO-8859-1\r\n";
// Sending the email
mail($to, $subject, $message, $headers);
$success_message1 = LANG_VALUE_136;
}
}
}
}
if($error_message1 != '') {
echo "<script>alert('".$error_message1."')</script>";
}
if($success_message1 != '') {
echo "<script>alert('".$success_message1."')</script>";
}
?>
<form action="" method="post">
<?php $csrf->echoInputField(); ?>
<h2><?php echo LANG_VALUE_93; ?></h2>
<div class="input-group">
<input type="email" class="form-control" placeholder="<?php echo LANG_VALUE_95; ?>" name="email_subscribe">
<span class="input-group-btn">
<button class="btn btn-theme" type="submit" name="form_subscribe"><?php echo LANG_VALUE_92; ?></button>
</span>
</div>
</div>
</form>
</div>
</div>
</div>
</section>
<?php endif; ?>
<div class="footer-bottom">
<div class="container">
<div class="row">
<div class="col-md-12 copyright">
<?php echo $footer_copyright; ?>
</div>
</div>
</div>
</div>
<a href="#" class="scrollup">
<i class="fa fa-angle-up"></i>
</a>
<?php
$statement = $pdo->prepare("SELECT * FROM tbl_settings WHERE id=1");
$statement->execute();
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as $row) {
$stripe_public_key = $row['stripe_public_key'];
$stripe_secret_key = $row['stripe_secret_key'];
}
?>
<script src="assets/js/jquery-2.2.4.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="https://js.stripe.com/v2/"></script>
<script src="assets/js/megamenu.js"></script>
<script src="assets/js/owl.carousel.min.js"></script>
<script src="assets/js/owl.animate.js"></script>
<script src="assets/js/jquery.bxslider.min.js"></script>
<script src="assets/js/jquery.magnific-popup.min.js"></script>
<script src="assets/js/rating.js"></script>
<script src="assets/js/jquery.touchSwipe.min.js"></script>
<script src="assets/js/bootstrap-touch-slider.js"></script>
<script src="assets/js/select2.full.min.js"></script>
<script src="assets/js/custom.js"></script>
<script>
function confirmDelete()
{
return confirm("Do you sure want to delete this data?");
}
$(document).ready(function () {
advFieldsStatus = $('#advFieldsStatus').val();
$('#paypal_form').hide();
$('#stripe_form').hide();
$('#bank_form').hide();
$('#advFieldsStatus').on('change',function() {
advFieldsStatus = $('#advFieldsStatus').val();
if ( advFieldsStatus == '' ) {
$('#paypal_form').hide();
$('#stripe_form').hide();
$('#bank_form').hide();
} else if ( advFieldsStatus == 'PayPal' ) {
$('#paypal_form').show();
$('#stripe_form').hide();
$('#bank_form').hide();
} else if ( advFieldsStatus == 'Stripe' ) {
$('#paypal_form').hide();
$('#stripe_form').show();
$('#bank_form').hide();
} else if ( advFieldsStatus == 'Bank Deposit' ) {
$('#paypal_form').hide();
$('#stripe_form').hide();
$('#bank_form').show();
}
});
});
$(document).on('submit', '#stripe_form', function () {
// createToken returns immediately - the supplied callback submits the form if there are no errors
$('#submit-button').prop("disabled", true);
$("#msg-container").hide();
Stripe.card.createToken({
number: $('.card-number').val(),
cvc: $('.card-cvc').val(),
exp_month: $('.card-expiry-month').val(),
exp_year: $('.card-expiry-year').val()
// name: $('.card-holder-name').val()
}, stripeResponseHandler);
return false;
});
Stripe.setPublishableKey('<?php echo $stripe_public_key; ?>');
function stripeResponseHandler(status, response) {
if (response.error) {
$('#submit-button').prop("disabled", false);
$("#msg-container").html('<div style="color: red;border: 1px solid;margin: 10px 0px;padding: 5px;"><strong>Error:</strong> ' + response.error.message + '</div>');
$("#msg-container").show();
} else {
var form$ = $("#stripe_form");
var token = response['id'];
form$.append("<input type='hidden' name='stripeToken' value='" + token + "' />");
form$.get(0).submit();
}
}
</script>
<?php echo $before_body; ?>
</body>
</html>