-
Notifications
You must be signed in to change notification settings - Fork 0
/
activate.php
271 lines (231 loc) · 8.21 KB
/
activate.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
<?php
include 'dbc.php';
foreach($_GET as $key => $value) {
$get[$key] = filter($value);
}
/******** EMAIL ACTIVATION LINK**********************/
if(isset($get['user']) && !empty($get['activ_code']) && !empty($get['user']) && is_numeric($get['activ_code']) ) {
$err = array();
$msg = array();
$user = mysql_real_escape_string($get['user']);
$activ = mysql_real_escape_string($get['activ_code']);
//check if activ code and user is valid
$rs_check = mysql_query("select id from users where md5_id='$user' and activation_code='$activ'") or die (mysql_error());
$num = mysql_num_rows($rs_check);
// Match row found with more than 1 results - the user is authenticated.
if ( $num <= 0 ) {
$err[] = "Sorry no such account exists or activation code invalid.";
//header("Location: activate.php?msg=$msg");
//exit();
}
if(empty($err)) {
// set the approved field to 1 to activate the account
$rs_activ = mysql_query("update users set approved='1' WHERE
md5_id='$user' AND activation_code = '$activ' ") or die(mysql_error());
$msg1 = "Thank you. Your account has been activated.";
header("Location: index.php?done=1&msg=$msg1");
//exit();
}
}
/******************* ACTIVATION BY FORM**************************/
if (@$_POST['doActivate']=='Activate')
{
$err = array();
$msg = array();
$user_email = mysql_real_escape_string($_POST['user_email']);
$activ = mysql_real_escape_string($_POST['activ_code']);
//check if activ code and user is valid as precaution
$rs_check = mysql_query("select id from users where user_email='$user_email' and activation_code='$activ'") or die (mysql_error());
$num = mysql_num_rows($rs_check);
// Match row found with more than 1 results - the user is authenticated.
if ( $num <= 0 ) {
$err[] = "Sorry no such account exists or activation code invalid.";
//header("Location: activate.php?msg=$msg");
//exit();
}
//set approved field to 1 to activate the user
if(empty($err)) {
$rs_activ = mysql_query("update users set approved='1' WHERE
user_email='$user_email' AND activation_code = '$activ' ") or die(mysql_error());
$msg[] = "Thank you. Your account has been activated.";
}
//header("Location: activate.php?msg=$msg");
//exit();
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="designer" content="Vijay George Richards" />
<title>Opti-Lawn.com - Home</title>
<link rel="shortcut icon" href="images/favicon.ico">
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
<link rel="stylesheet" href="validationEngine.jquery.css" type="text/css">
<script type="text/javascript" src="js/jquery.js"></script>
<script src="js/jquery.validationEngine-en.js" type="text/javascript"></script>
<script src="js/jquery.validationEngine.js" type="text/javascript"></script>
</head>
<script type="text/javascript">
// ------------------
(function ($) {
$.fn.vAlign = function(container) {
return this.each(function(i){
if(container == null) {
container = 'div';
}
$(this).html("<" + container + ">" + $(this).html() + "</" + container + ">");
var el = $(this).children(container + ":first");
var elh = $(el).height(); //new element height
var ph = $(this).height(); //parent height
var nh = (ph - elh) / 2; //new height to apply
$(el).css('margin-top', nh);
});
};
})(jQuery);
// ------------------
$(document).ready(function() {
$("#logForm").validationEngine('attach',{scroll: false});
// ------------------LOGIN POPUP------------------------
$('a.poplight').click(function() {
var popID = $(this).attr('rel');
var popURL = $(this).attr('href');
var query= popURL.split('?');
var dim= query[1].split('&');
var popWidth = dim[0].split('=')[1];
$('#' + popID).fadeIn().css({ 'width': Number( popWidth ) }).prepend('<a href="#" class="close"><img src="images/close_pop.png" class="btn_close" title="Close Popup" alt="Close" /></a>');
var popMargTop = ($('#' + popID).height() + 80) / 2;
var popMargLeft = ($('#' + popID).width() + 80) / 2;
$('#' + popID).css({
'margin-top' : -popMargTop,
'margin-left' : -popMargLeft
});
$('body').append('<div id="fade"></div>');
if($.browser.msie && $.browser.version=="6.0") {
$('img.btn_close').css({
'float': 'right',
'margin': '-20px -20px 0 0'});
$('#fade').css("height", $(window).height()*2);
}
else{
$('img.btn_close').css({
'float': 'right',
'margin': '-55px -55px 0 0'});
$('#fade').css("height", '100%');
};
$('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn();
return false;
});
$('a.close').live('click', function() {
$('#fade , .popup_login').fadeOut(function() {
$('#logForm').validationEngine('hideAll');
$('#fade, a.close').remove();
});
return false;
});
// -----------------------------------------------------
});
</script>
</head>
<body>
<body>
<center>
<div id="main_container">
<div id="header">
<div id="logo" class="logo floatl">
<a href="index.php"><img src="images/logo.gif" height="77px" width="189px" alt="" title="" border="0" /></a>
</div>
<div class="loginbox floatr">
<?php
include 'userdetails.php';
user_details();
?>
</div>
<?php
include 'menu.php';
?>
</div>
<?php
if(!empty($err)){
echo "<div class=\"error\">";
foreach ($err as $e) {
echo "$e<br>";
}
echo "</div>";
}
?>
<div class="mainbody">
<h2>Account Activation</h2>
<p>
<?php
/******************** ERROR MESSAGES*************************************************
This code is to show error messages
**************************************************************************/
if(!empty($err)) {
echo "<div class=\"msg\">";
foreach ($err as $e) {
echo "* $e <br>";
}
echo "</div>";
}
if(!empty($msg)) {
echo "<div class=\"msg\">" . $msg[0] . "</div>";
}
/******************************* END ********************************/
?>
</p>
<p>Please enter your email and activation code sent to you to your email
address to activate your account. Once your account is activated you can
<a href="index.php">login here</a>.</p><br>
<form action="activate.php" method="post" name="actForm" id="actForm" >
<table width="65%" border="0" cellpadding="4" cellspacing="4" class="loginform">
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td width="36%">Your Email</td>
<td width="64%"><input name="user_email" type="text" class="required email" id="txtboxn" size="25"></td>
</tr>
<tr>
<td>Activation code</td>
<td><input name="activ_code" type="password" class="required" id="txtboxn" size="25"></td>
</tr>
<tr>
<td colspan="2"> <div align="center">
<p>
<input name="doActivate" type="submit" id="doLogin3" value="Activate">
</p>
</div></td>
</tr>
</table>
<div align="center"></div>
<p align="center"> </p>
</form>
<p> </p>
</div>
<div id="footer">
<div class="fleft"></div>
<div class="fcenter">All rights reserved</div>
<div class="fright"></div>
</div>
</div>
<!-- ------------------------------------------ -->
<div id="popup_login" class="popup_login">
<form action="index.php" method="post" name="logForm" id="logForm" >
<p align="center">Login ID or Email address:<br>
<input name="usr_email" type="text" class="validate[required] text-input" id="usr_email" size="35">
<br><br>Password:<br>
<input name="pwd" type="password" class="validate[required] text-input" id="pwd" size="35">
<br><br>
<input name="remember" type="checkbox" id="remember" class="remember" value="1" checked="checked" style="display:none;">
<DIV class="buttons">
<input class="regular button login" name="doLogin" type="submit" id="doLogin" value="Login">
</div>
</form>
<br>
New to Omni-Lawn.com <a href="register.php">Register</a> | <a href="forgot.php">Forgot Password</a></p>
</div>
<!-- ------------------------------------------ -->
</center>
</body></html>