-
Notifications
You must be signed in to change notification settings - Fork 2
/
alertRegistration.php
272 lines (236 loc) · 9.02 KB
/
alertRegistration.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
272
<?php
error_reporting(0);
include_once 'utility.php';
session_start();
$errors=array();
$pinid="";
$email="";
$password="";
$errorKeys = parse_ini_file("error.ini");
if(!isset($_SESSION['pinnerid'])){
$pinnerId=$_GET['pinnerId'];
$_SESSION['pinnerid']=$pinnerId;
}
$loginType="0";
if(isset($_POST['pinnerid'])){
$loginType=1;
$pinnerid=trim($_POST['pinnerid']);
$email=trim($_POST['email']);
$password=trim($_POST['password']);
$fname=trim($_POST['fname']);
$lname=trim($_POST['lname']);
$errors=validateRegistration($pinnerid, $email, $password);
if(empty($lname)){
$error[7]=7;
}
if(empty($fname)){
$error[6]=6;
}
if(count($errors)==0){
$res=insertRegistrationDetails($pinnerid, $email, $password,$fname,$lname);
$_SESSION['pinnerid']=$pinnerid;
$_SESSION['email']=$email;
$_SESSION['auth']=true;
header("Location: showindividualproduct.php?auth=true");
}
}
$message="";
if(isset($_POST['existinguser'])){
$loginType=2;
$email=trim($_POST['email']);
$password=trim($_POST['password']);
$errors=validateRegistration("test", $email, $password);
if(checkExistingUser($email, $password) && count($errors)==0){
$_SESSION['email']=$email;
$_SESSION['auth']=true;
header("Location: showindividualproduct.php?auth=true");
}else{
$message="Invalid username/password";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Pinterest</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le styles -->
<link href="assets/css/bootstrap.css" rel="stylesheet">
<link href="assets/css/bootstrap-responsive.css" rel="stylesheet">
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="assets/ico/favicon.ico">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="assets/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="assets/ico/apple-touch-icon-57-precomposed.png">
<script src="assets/js/jquery.js"></script>
<script src="assets/js/bootstrap-transition.js"></script>
<script src="assets/js/bootstrap-alert.js"></script>
<script src="assets/js/bootstrap-modal.js"></script>
<script src="assets/js/bootstrap-dropdown.js"></script>
<script src="assets/js/bootstrap-scrollspy.js"></script>
<script src="assets/js/bootstrap-tab.js"></script>
<script src="assets/js/bootstrap-tooltip.js"></script>
<script src="assets/js/bootstrap-popover.js"></script>
<script src="assets/js/bootstrap-button.js"></script>
<script src="assets/js/bootstrap-collapse.js"></script>
<script src="assets/js/bootstrap-carousel.js"></script>
<script src="assets/js/bootstrap-typeahead.js"></script>
<script src="assets/jquery.min.js" type="text/javascript"></script>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="#">Pinterest</a>
<div class="nav-collapse">
<ul class="nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
</div>
<div class="container">
<div class="row" style="padding-top: 50px;">
</div>
<div class="row">
<div class="span12">
<form class="form-horizontal" action="" method="POST">
<fieldset>
<div class="control-group">
<label for="input01" class="control-label">Pinterest User Id</label>
<div class="controls">
<input type="text" id="pinid" name="pinnerid" class="input-xlarge" value="<?php echo $_SESSION['pinnerid'];?>">
<p class="help-block">This shuould be the pinterest userid</p>
</div>
<div>
<?php
if(array_key_exists('1',$errors) && $loginType==1){
echo '<font color=red>' . $errorKeys[1] . '</font>';
}
if(array_key_exists('5',$errors) && $loginType==1){
echo '<font color=red>' . $errorKeys[5] . '</font>';
}
?>
</div>
</div>
<div class="control-group">
<label for="input01" class="control-label">First Name</label>
<div class="controls">
<input type="text" id="email" name="fname" class="input-xlarge">
</div>
<?php
if(array_key_exists('6',$errors) && $loginType==1){
echo '<font color=red>' . $errorKeys[6] . '</font>';
}
?>
</div>
<div class="control-group">
<label for="input01" class="control-label">Last Name</label>
<div class="controls">
<input type="text" id="email" name="lname" class="input-xlarge">
</div>
<?php
if(array_key_exists('6',$errors) && $loginType==1){
echo '<font color=red>' . $errorKeys[7] . '</font>';
}
?>
</div>
<div class="control-group">
<label for="input01" class="control-label">Email</label>
<div class="controls">
<input type="text" id="email" name="email" class="input-xlarge">
</div>
<?php
if(array_key_exists('2',$errors) && $loginType==1){
echo '<font color=red>' . $errorKeys[2] . '</font>';
}
if(array_key_exists('3',$errors) && $loginType==1){
echo '<font color=red>' . $errorKeys[3] . '</font>';
}
?>
</div>
<div class="control-group">
<label for="input01" class="control-label">Password</label>
<div class="controls">
<input type="password" id="password" name="password" class="input-xlarge">
</div>
<div>
<?php
if(array_key_exists('4',$errors) && $loginType==1){
echo '<font color=red>' . $errorKeys[4] . '</font>';
}
?>
</div>
</div>
<div class="control-group"> <div class="controls">
<button class="btn btn-primary">Create Account</button>
</div>
</div>
</fieldset>
</form>
</div>
</div>
<div class="row">
<div class="span12">
<label > Existing User: </label>
<br/>
<font color="red"><?php echo $message;?></font>
<form class="form-horizontal" action="" method="POST">
<div class="control-group">
<label for="input01" class="control-label">Email</label>
<div class="controls">
<input type="text" id="email" name="email" class="input-xlarge">
</div>
<?php
if(array_key_exists('2',$errors) && $loginType==2){
echo '<font color=red>' . $errorKeys[2] . '</font>';
}
if(array_key_exists('3',$errors) && $loginType==2){
echo '<font color=red>' . $errorKeys[3] . '</font>';
}
?>
</div>
<div class="control-group">
<label for="input01" class="control-label">Password</label>
<div class="controls">
<input type="password" id="password" name="password" class="input-xlarge">
</div>
<div>
<?php
if(array_key_exists('4',$errors) && $loginType==2){
echo '<font color=red>' . $errorKeys[4] . '</font>';
}
?>
</div>
</div>
<div class="control-group"> <div class="controls">
<button class="btn btn-primary">Log in</button>
</div>
</div>
<input type="hidden" name="existinguser" value="y">
</form>
</div>
</div>
<footer>
<p>© Company 2012</p>
</footer>
</div>
</body>
</html>