-
Notifications
You must be signed in to change notification settings - Fork 0
/
registration.php
181 lines (170 loc) · 6 KB
/
registration.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
<?php
require_once 'core/init.php';
$user = new User();
if($user->isLoggedIn())
//Redirect::to('index.php');
echo '<script>window.location.href="index.php"</script>';
if(0)
{
if(Tokens::check(Input::get('token')))
{
$validate = new Validate();
$validation = $validate->check($_POST, array(
'password' => array(
'required' => true,
'min' => 8
),
'confirmPassword' => array(
'required' => true,
'matches' => 'password'
),
'name' => array(
'required' => true,
'max' => 50
),
'contact' => array (
'required' => true,
'min' => 10,
'max' => 10
),
'email' => array('required'=>true),
'school' => array('required'=>true),
'city' => array('required' => true)
));
if($validation->passed())
{
$salt = Hash::salt(32);
try
{
$user->create(array(
'name' => Input::get('name'),
'email' => Input::get('email'),
'password' => Hash::make(Input::get('password'), $salt),
'salt' => $salt,
'contact' => Input::get('contact'),
'school' => Input::get('school'),
'city' => Input::get('city'),
'avtar' => Input::get('emotion') ? Input::get('emotion') : 1
));
}
catch(Exception $e)
{
die($e->getMessage());
}
Session::flash('home', 'You have been successfully registered');
//Redirect::to('index.php');
echo'<script> alert( "Log in to Continue");</script>';
echo '<script>window.location.href="login.php"</script>';
}
else
{
echo "<ul class='list-group'>";
foreach($validation->errors() as $error)
{
echo '<li class="list-group-item">'.$error.'</li>';
}
echo "<a href='index.php' class='btn btn-danger btn-md'>Click here to go back</a>";
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Registeration</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<style>
.input-hidden {
position: absolute;
left: -9999px;
}
input[type=radio]:checked + label>img {
border: 1px solid #fff;
box-shadow: 0 0 3px 3px #090;
}
/* Stuff after this is only to make things more pretty */
input[type=radio] + label>img {
border: 1px dashed #444;
width: 150px;
height: 150px;
transition: 500ms all;
}
input[type=radio]:checked + label>img {
transform:
rotateZ(-10deg)
rotateX(10deg);
}
</style>
</head>
<body>
<form method="post" action="" class="form-horizontal" id="form" style="margin-top:30px;margin-left:35%;">
<div class="form-group">
<label for="name" class="col-sm-2 control-label">Name</label>
<div class="col-xs-4">
<input type="text" name="name" class="form-control" id="name" placeholder="Enter your name">
</div>
</div>
<div class="form-group">
<label for="inputEmail" class="col-sm-2 control-label">Email</label>
<div class="col-xs-4">
<input type="email" name="email" class="form-control" id="inputEmail" placeholder="Email"><span id="email"></span>
</div>
</div>
<div class="form-group">
<label for="inputPassword" class="col-sm-2 control-label">Password</label>
<div class="col-xs-4">
<input type="password" name="password" class="form-control" id="inputPassword" placeholder="Password">
</div>
</div>
<div class="form-group">
<label for="confirmPassword" class="col-sm-2 control-label">Confirm Password</label>
<div class="col-xs-4">
<input type="password" name="confirmPassword" class="form-control" id="confirmPassword" placeholder="Confirm Password"><span id="pass"></span>
</div>
</div>
<div class="form-group">
<label for="Institute" class="col-sm-2 control-label">Institue</label>
<div class="col-xs-4">
<input type="text" name="school" class="form-control" id="Institute" placeholder="Enter your Institue">
</div>
</div>
<div class="form-group">
<label for="contact" class="col-sm-2 control-label">Contact Number</label>
<div class="col-xs-4">
<input type="text" name="contact" class="form-control" id="contact" placeholder="Enter your contact number"><span id="err"></span>
</div>
</div>
<div class="form-group">
<label for="city" class="col-sm-2 control-label">City</label>
<div class="col-xs-4">
<input type="text" name="city" class="form-control" id="city" placeholder="Enter your city">
</div>
</div>
<b>choose your avatar:</b><br><br>
<div style="margin-left:70px;">
<input
type="radio" name="emotion"
id="sad" class="input-hidden" value="1" />
<label for="sad">
<img
src="images/img.png"
alt="ash" />
</label>
<input
type="radio" name="emotion"
id="happy" class="input-hidden" value="2" />
<label for="happy">
<img
src="images/misty.png"
alt="misty" /></div>
<div class="form-group" style="margin-top:40px;margin-left:35px;">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary" id="button" >Register</button>
</div>
</div>
<input type="hidden" name="token" value="<?php echo escape(Tokens::generate()); ?>" />
</form>
<script type="text/javascript" src="scripts/jquery.min.js"></script>
<script type="text/javascript" src="scripts/style.js"></script>
</body>
</html>