-
Notifications
You must be signed in to change notification settings - Fork 0
/
emaillist.php
215 lines (176 loc) · 5.94 KB
/
emaillist.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
<?php
include 'dbc.php';
$err = array();
if(@$_POST['doRegister'] == 'Register')
{
/******************* Filtering/Sanitizing Input *****************************
This code filters harmful script code and escapes data of all POST data
from the user submitted form.
*****************************************************************/
foreach($_POST as $key => $value) {
$data[$key] = filter($value);
}
/************************ SERVER SIDE VALIDATION **************************************/
/********** This validation is useful if javascript is disabled in the browswer ***/
if(empty($data['email']) || !isEmail($data['email']))
{
$err[] = "ERROR - Invalid email. Please enter a valid email";
//header("Location: register.php?msg=$err");
//exit();
}
$usr_email = $data['email'];
/************ USER EMAIL CHECK ************************************
This code does a second check on the server side if the email already exists. It
queries the database and if it has any existing email it throws user email already exists
*******************************************************************/
$rs_duplicate = mysql_query("select count(*) as total from `newsletter` where email='$usr_email'") or die();
list($total) = mysql_fetch_row($rs_duplicate);
if ($total > 0)
{
$err[] = "ERROR - The email already exists.";
//header("Location: register.php?msg=$err");
//exit();
}
/***************************************************************************/
if(empty($err)) {
$sql_insert = "INSERT into `newsletter`
(`email`,`date`,`active`
)
VALUES
('$usr_email',now(),'1')
";
mysql_query($sql_insert,$link) or die();
}
}
?>
<!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" />
<title>Omni-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>";
}
else{
echo "<div class=\"success\">Email updated in our database</div>";
}
?>
<div class="mainbody">
</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 Opti-Lawn.com <a href="register.php">Register</a> | <a href="forgot.php">Forgot Password</a></p>
</div>
<!-- ------------------------------------------ -->
</center>
</body></html>