-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
205 lines (196 loc) · 8.38 KB
/
index.php
File metadata and controls
205 lines (196 loc) · 8.38 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<?php
session_start();
if(isset($_SESSION) && !(empty($_SESSION['user'])))
{
header('Location: '."mainpage.php");
}
elseif(isset($_COOKIE['user']))
{
$_SESSION['user']=$_COOKIE['user'];
header('Location: '."mainpage.php");
}
?>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>SaanjhiDrive</title>
<link href="css/signin.css" rel="stylesheet">
<link rel="shortcut icon" href="images/icon.ico">
<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="js/jquery.leanModal.min.js"></script>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" />
<link type="text/css" rel="stylesheet" href="css/style.css" />
</head>
<body>
<div class="panel-heading">
<h2 class="panel-title">Welcome To SaanjhiDrive</h2>
<h3 class="panel-subtitle">Saaddi drive, tuhada data!</h3>
</div>
<div class="all">
<!--login_container class contains all the elements defined in the main page-->
<div class="login_container">
<div class="row">
<div class="col-sm-4">
<div class="panel panel-default">
<div class="panel-body">
<form action="sign_in.php" name="signinform" class="form-signin" role="form" method="POST" >
<h2 class="form-signin-heading">Sign in</h2><br>
<input id = "a" name="usrname" type="text" class="form-control" placeholder="Username"><br><div class="br1"></div>
<input id = "b" name="usrpwd" type="password" class="form-control" placeholder="Password" ><div class="br2"></div>
<label class="checkbox">
<input name="rmbrme" type="checkbox" value="remember-me"> Remember me<br><div class="br1"></div>
</label>
<a class="forgotpwd" id="modal_trigger" href="#modal"><div style="text-align:left; color:white; text-decoration: none;">Forgot Password?</div></a><br>
<button class="btn_signin" type="submit" onclick="signin()">Sign in</button>
</form>
</div>
</div>
</div>
</div>
</div>
<br>
<div class="container">
<a id="modal_trigger1" href="#modal1" class="btn">Create account</a>
<!--class: popupContainer pops out when "Create new account clicked"--->
<div id="modal" class="popupContainer1" style="display:none;">
<header class="popupHeader">
<span class="header_title">Having Trouble in sign-in !!</span>
<span class="modal_close"><i class="fa fa-times"></i></span>
</header>
<!--main popup form that appears-->
<section class="popupBody">
<div class="user_register">
<form name="signup_form" role="form" id="my_form">
<input id= "regemail1" name="regemail1" type="email" class="regform-control" placeholder="Email address" required>
<br />
<div class="action_btns">
<button class="forgot_btn" type="submit" onclick="check_userregemail()">Send Password</button>
</div>
</form>
</div>
</section>
</div>
<div id="modal1" class="popupContainer" style="display:none;">
<header class="popupHeader">
<span class="header_title">Register</span>
<span class="modal_close"><i class="fa fa-times"></i></span>
</header>
<!--main popup form that appears-->
<section class="popupBody">
<div class="user_register">
<form action="register.php" name="signup_form" role="form" id="my_form" method="POST" >
<input id= "rega" name="regusrname" type="text" class="regform-control" placeholder="Username" onkeyup="check_username()" required>
<br/>
<input id= "regemail" name="regemail" type="email" class="regform-control" placeholder="Email address" required>
<br />
<input id = "regb" name="regusrpwd" type="password" class="regform-control" placeholder="Password" required onkeyup="check_userpwd()">
<br />
<input id = "regreb" name="regreusrpwd" type="password" class="regform-control" placeholder="Re-Enter Password" required onkeyup="check_userrepwd()"><div class="br2"></div>
<br><br>
<div class="action_btns">
<button class="register_btn" type="submit" onclick="check_userrepwd()">Register</button>
</div>
</form>
</div>
</section>
</div>
</div>
</div>
<!--below code to show the signup_form-->
<?php
if(isset($_GET) && !empty($_GET['response']))
{
if($_GET['response']==1){
echo '<script language="javascript">';
echo 'alert("User name already taken.")';
echo '</script>';
}
elseif($_GET['response']==2){
echo '<script language="javascript">';
echo 'alert("Unable to connect to database.")';
echo '</script>';
}
elseif($_GET['response']==3){
echo '<script language="javascript">';
echo 'alert("Username-Password combination was incorrect.")';
echo '</script>';
}
}
?>
<script type="text/javascript">
$("#modal_trigger").leanModal({top : 200, overlay : 0.6, closeButton: ".modal_close" });
$(function(){
// Calling Register Form
$("#modal_trigger").click(function(){
$(".user_register").show();
return false;
});
})
$("#modal_trigger1").leanModal({top : 200, overlay : 0.6, closeButton: ".modal_close" });
$(function(){
// Calling Register Form
$("#modal_trigger1").click(function(){
$(".user_register").show();
return false;
});
})
</script>
<script type="text/javascript">
//checking validation of username and userpassword of form : signinform
function signin() {
var uname = document.getElementById("a").value;
var upwd = document.getElementById("b").value;
if (uname == null || uname == "") {
document.getElementById("a").required = true;
}
else if (upwd == null || upwd == "") {
document.getElementById("b").required = true;
}
}
//checking validation of username, emailid, password(both) of signup_form.
function check_username() {
var reguname = document.getElementById('rega').value;
if (reguname == null || reguname == "") {
document.getElementById("rega").setCustomValidity('Please fill out this field') = true;
}
else if (!reguname.match(/^[a-zA-Z0-9_]+$/) || reguname.length < 5 || reguname > 12) {
document.getElementById("rega").setCustomValidity('You can only enter _ or (a-z) or (A-Z) and number of characters should be between 5-12 !!') = true;
}
else {
document.getElementById("rega").setCustomValidity('') = true;
}
}
//checking validation of password of signup_form.
function check_userpwd() {
var regupwd = document.getElementById('regb').value;
if (regupwd == null || regupwd == "") {
document.getElementById("regb").setCustomValidity('Please fill out this field') = true;
}
else if (regupwd.length < 8 || regupwd.length > 12) {
document.getElementById("regb").setCustomValidity('You password lenght should be between 8-12 !!') = true;
}
else {
document.getElementById("regb").setCustomValidity('') = true;
}
}
//checking validation of both the passwords of signup_form.
function check_userrepwd() {
var regupwd = document.getElementById('regb').value;
var regreupwd = document.getElementById('regreb').value;
if (regupwd != regreupwd) {
document.getElementById("regreb").setCustomValidity('This does not match with your password!') = true;
return false;
}
else {
document.getElementById("regreb").setCustomValidity('') = true;
return true;
}
}
</script>
</body>
</html>