-
Notifications
You must be signed in to change notification settings - Fork 0
/
redirect_cashback.php
executable file
·202 lines (173 loc) · 5.78 KB
/
redirect_cashback.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
<?php
include('./requiert/php-global.php');
include('./administration/cashback/inc/functions.inc.php');
define('COUNT_NOTMEMBERS', 0);
if(!isset($_SESSION['id'])){
header("Location: connexion.php");
exit();
}
$userid = (int)$_SESSION['id'];
if (isset($_GET['id']) && is_numeric($_GET['id']))
{
$retailer_id = (int)$_GET['id'];
} else {
header ("Location: cashback.php");
exit();
}
$query = "SELECT * FROM cashbackengine_retailers WHERE retailer_id='$retailer_id' AND end_date > NOW() AND status='active'";
$req = $pdo->query($query);
$result = $req->fetch();
if ($result)
{
$row = $result;
$store_name = $row['title'];
$cashback = DisplayCashback($row['cashback']);
$website_url = str_replace("{USERID}", $userid, $row['url']);
$sql = 'UPDATE cashbackengine_retailers SET visits = visits + 1 WHERE ( retailer_id = :retailer_id )';
$stm = $pdo->prepare( $sql );
$stm->execute(array(':retailer_id' => $retailer_id));
}
else
{
header ("Location: cashback.php");
exit();
}
if (isset($_GET['c']) && is_numeric($_GET['c']) && $_GET['c'] > 0)
{
$coupon_id = (int)$_GET['c'];
$coupon_query = "SELECT * FROM cashbackengine_coupons WHERE coupon_id='$coupon_id'";
$coupon_result = $pdo->query($coupon_query)->fetch();
if ($coupon_result)
{
$coupon_row = $coupon_result;
$coupon_link = $coupon_row['link'];
if ($coupon_link != "")
{
$website_url = str_replace("{USERID}", $userid, $coupon_link);
}
$stm = $pdo->prepare( 'UPDATE cashbackengine_coupons SET visits = visits + 1, last_visit=NOW() WHERE ( coupon_id = :coupon_id )' );
$stm->execute(array(':coupon_id' => $coupon_id));
$stm = $pdo->prepare( 'UPDATE cashbackengine_coupons SET visits_today = visits_today + 1 WHERE ( coupon_id = :coupon_id AND DATE(last_visit)=DATE(NOW()) )' );
$stm->execute(array(':coupon_id' => $coupon_id));
}
}
?>
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Cashback</title>
<meta http-equiv="refresh" content="3; url=<?php echo $website_url; ?>" />
<link href="./administration/cashback/css/bootstrap.min.css" rel="stylesheet" />
<!--[if lt IE 9]>
<script src="./administration/cashback/js/html5shiv.js"></script>
<script src="./administration/cashback/js/respond.min.js"></script>
<![endif]-->
<link href="http://fonts.googleapis.com/css?family=Open+Sans+Condensed:700" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body {
background: #F0F1F2;
font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
font-size: 13px;
color: #000000;
margin: 0;
padding: 0;
}
a {
color: #3498DB;
text-decoration: none;
}
a:hover {
color: #2674A9;
}
.header {
width: 100%;
height: 100px;
background: #FFF;
padding: 15px 0;
}
.container {
width: 100%;
height: 100%;
position: absolute;
top: 25%;
left: 35%;
width: 350px;
}
.box {
position: relative;
float: left;
height: 225px;
width: 400px;
padding: 0 20px 20px 20px;
text-align: left;
border: 1px solid #DDD;
background: #FFFFFF;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
position: relative;
-moz-box-shadow: 0 0 5px 5px #E2E2E2;
-webkit-box-shadow: 0 0 5px 5px #E2E2E2;
box-shadow: 0 0 5px 5px #E2E2E2;
}
.msg {
font-family: 'Open Sans Condensed', Times, Arial, Verdana, sans-serif;
font-size: 18px;
font-weight: 600;
color: #777777;
line-height: 30px;
text-align: left;
}
.msg .username {
color:#000;
}
.cashback {
font-family: 'Open Sans Condensed', Times, Arial, Verdana, sans-serif;
font-size: 24px;
font-weight: 600;
color: #84E028;
line-height: 30px;
text-align: left;
}
.store-name {
line-height: 30px;
font-family: 'Open Sans Condensed', Times, Arial, Verdana, sans-serif;
font-size: 24px;
font-weight: 500;
color: #62AAF7;
text-align: left;
}
.logo {
position: absolute;
float: right;
top: 90px;
right: 15px;
/*border: 5px solid #F9F9F9;*/
}
.info {
width: 100%;
position: absolute;
bottom: 0;
left: 0;
padding: 10px 5px;
text-align: center;
}
-->
</style>
</head>
<body>
<div class="header"><center><a href="cashback.php"><img src="/img/logo.png" /></a></center></div>
<div class="container">
<div class="box">
<p align="center">Redirection <br/><br/></p>
<div class="msg">
Redirection en cours de traitement ...
</div>
<div class="info"><?php echo str_replace("%url%", $website_url, '<a href="%url%">Cliquez ici </a> si vous n\'êtes pas redirigé dans 5 secondes .'); ?></div>
</div>
</div>
</body>
</html>