-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
251 lines (236 loc) · 11.4 KB
/
index.php
File metadata and controls
251 lines (236 loc) · 11.4 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
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
<?php
ob_start(); // this is output buffering useful in re-directing header locations
session_start();
if((isset($_SESSION['user_id']) && isset($_SESSION['user_email']) && isset($_SESSION['user_name']) && isset($_SESSION['user_image']) && isset($_SESSION['signup_time'])))
header("Location:home");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>CYBERDEN | Login</title>
<!-- Font Awesome -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Bootstrap core CSS -->
<link href="assets/mdb/css/bootstrap.min.css" rel="stylesheet">
<!-- Material Design Bootstrap -->
<link href="assets/mdb/css/mdb.min.css" rel="stylesheet">
<!-- Your custom styles (optional) -->
<link href="assets/mdb/css/style.css" rel="stylesheet">
<link href="assets/mdb/css/sidebar.css" rel="stylesheet">
<!-- Our Custom CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.min.css">
<style>
body{
padding-top : 0px !important;
}
</style>
</head>
<body>
<!-- Start your project here-->
<div class="wrapper">
<!-- Sidebar -->
<nav id="sidebar">
<div id="sibebar_content_opacity">
</div>
<div id="sidebar_content">
<div id="dismiss">
<i class="fa fa-arrow-left"></i>
</div>
<!--h3 align="center">InstinctMe</h3-->
<!--ul id="sidebar_list">
<li class="sidebar_item">HOme</li>
<li class="sidebar_item">SIgnup</li>
</ul-->
<!--div id="user_div" align="center" style="border-bottom:1px solid lightblue">
<img src="assets/mdb/img/sidebar_3.jpg" width="100px" height="100px" style="border-radius: 50%"/>
<h3 style="color:lightblue"><i class="fa fa-user"></i>UserName</h3>
</div-->
<div id="instinctme_brand" style="border-bottom: 1px solid lightblue">
<br /><br />
<span style="font-style:bold;font-size:20px">CYBERDEN</span>
</div>
<div id="sidebar_list">
<ul type="none" style="width : 100%;padding:0px;margin:0px">
<li class="btn"><a href="contact"><i class="fa fa-home"></i> Contact Us</a></li>
<li class="btn"><a href="#"><i class="fa fa-user-plus"></i> About Us</a></li>
<li class="btn"><a href="#"><i class="fa fa-home"></i> Support Us</a></li>
</ul>
</div>
<div id="sidebar_logout" align="center" style="margin-top : 20px">
<button type="button" class="btn btn-info" onclick="window.location.href='register'"><a href="#" style="color:white ">Register</a></button>
</div>
</div>
</nav>
</div>
<nav class="navbar navbar-expand-lg navbar-dark ">
<div class="container">
<a class="navbar-brand px-lg-4 mr-0 btn btn-outline-info" href="#">
<span style="font-style:bold;font-size:20px">CYBERDEN</span>
</a>
<!-- Collapse button -->
<button class="navbar-toggler" type="button" id="sidebarCollapse" >
<span class="navbar-toggler-icon" style="background-color:lightblue!important"></span>
</button>
<!-- Collapsible content -->
<div class="collapse navbar-collapse justify-content-end font-weight-bold" id="basicExampleNav">
<!-- Navbar brand -->
<ul class="navbar-nav">
<li class="nav-item">
<button class="btn btn-outline-info btn-sm" style="border-radius:30px" onclick="window.location.href='register'">Register</button>
</li>
</ul>
</div>
</nav>
<!-- /Start your project here-->
<div class="container">
<div class="row">
<div class="col-md-4">
</div>
<div class="col-md-4">
<!-- Default form login -->
<div class=" p-3 card">
<p class="h4 mb-4 text-center" style="margin-bottom:0px;padding-bottom:0px;">Sign in</p>
<!-- Email -->
<!--input type="email" id="defaultLoginFormEmail" class="form-control mb-4" placeholder="E-mail"-->
<p id="login_msg" align="center"> </p>
<div class="md-form">
<i class="fa fa-envelope prefix"></i>
<input type="email" id="email_login" name="email" class="form-control">
<label for="email" > Email </label>
</div>
<!-- Password -->
<!--input type="password" id="defaultLoginFormPassword" class="form-control mb-4" placeholder="Password"-->
<div class="md-form">
<i class="fa fa-lock prefix"></i>
<input type="password" id="password_login" name="password" class="form-control">
<label for="password" > Password </label>
</div>
<div class="d-flex justify-content-around">
<div>
<!-- Remember me -->
<!--div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="defaultLoginFormRemember">
<label class="custom-control-label" for="defaultLoginFormRemember" style="font-size:13px">Remember me</label>
</div-->
</div>
</div>
<!-- Sign in button -->
<button class="btn btn-info btn-block my-4" type="submit" onclick="login()">Sign in</button>
<!-- Register -->
<p style="font-size:11px" align="center">Not a member?
<a href="register" class="text text-info" ><b>Register</b></a>
</p>
<div align="center">
<!-- Forgot password -->
<a href="#" id='forgot_password' style="font-size:11px;" class="text text-info"><b>Forgot password?</b></a>
</div>
</div>
<!-- Default form login -->
</div>
</div>
<div class="row">
<div class="col-sm-12" align="center" style="padding-top:20px;font-size:12px">
<p><a href="#" style="padding-right:20px!important">About Us</a> | <a href="contact" style="padding-left:10px;padding-right:10px">Contact Us</a> | <a href="#" style="padding-left:10px">Support Us</a></p>
</div>
<div class="col-sm-12" align="center">
<span style="font-size:10px">©InstinctMe 2018</span>
</div>
</div>
<!-- modal for engineering day wishes -->
<!--div class="modal fade" id="wishes_modal" tabindex="-1" aria-labelledby="myModalLabel" aria-hidden="true" style="width:100%">
<div class="modal-dialog modal-lg" style="width:100%">
<div class="modal-content">
<div class="modal-body">
<img src="assets/mdb/img/e.jpg" width="100%" height="100%"/>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div>
</div>
</div-->
</div>
<!-- SCRIPTS -->
<!-- JQuery -->
<script type="text/javascript" src="assets/mdb/js/jquery-3.3.1.min.js"></script>
<!-- Bootstrap tooltips -->
<script type="text/javascript" src="assets/mdb/js/popper.min.js"></script>
<!-- Bootstrap core JavaScript -->
<script type="text/javascript" src="assets/mdb/js/bootstrap.min.js"></script>
<!-- MDB core JavaScript -->
<script type="text/javascript" src="assets/mdb/js/mdb.min.js"></script>
<!-- jQuery Custom Scroller CDN -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.concat.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#sidebar").mCustomScrollbar({
theme: "minimal"
});
$('#dismiss, .overlay').on('click', function () {
$('#sidebar').removeClass('active');
$('.overlay').removeClass('active');
});
$('#sidebarCollapse').on('click', function () {
$('#sidebar').addClass('active');
$('.overlay').addClass('active');
$('.collapse.in').toggleClass('in');
$('a[aria-expanded=true]').attr('aria-expanded', 'false');
});
var sidebar_parent_height = $("#sidebar")[0].scrollHeight;
var sidebar_child_height = $("#sidebar_content").height();
//alert(sidebar_parent_height + " " + sidebar_child_height);
if(sidebar_parent_height > sidebar_child_height){
$("#sidebar_content").height(sidebar_parent_height);
}else{
}
// to launch the modal
//\$("#wishes_modal").modal("show");
// to throw message when forgot paswd is clicked
$("#forgot_password").on('click',function(){
$("#login_msg").html("Please throw a mail to admin@instinctme.com");
});
});
function login(){
var email = $("#email_login").val();
var password = $("#password_login").val();
if(!(validateEmail(email))){
$("#login_msg").html("<span style='color:red;font-size:12px'>Enter valid email</span>")
return;
}
if(email && password){
$("#login_msg").html("<b><i class='fa fa-spinner fa-spin'></i></b>");
$.post("php/login.php",{email : email, password : password},function(data){
if(data == "success"){
$("#login_msg").html("<span>Login success....</span>");
window.location.href="home";
}else if(data == "invalid password"){
$("#login_msg").html("<span style='color:red;font-size:12px'>Invalid username or password</span>");
}else if(data == "invalid email"){
$("#login_msg").html("<span style='color:red;font-size:12px'>Invalid username or password</span>"); // invalid email
}else if(data == "fail"){
$("#login_msg").html("<span style='color;font-size:12px'>Invalid details.</span>");
}else{
$("#login_msg").html(data);
}
});
}else{
$("#login_msg").html("<span style='color:red;font-size:12px'>Please fill out all the fields.</span>");
}
}
function validateEmail(email){
var filter = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
if (filter.test(email)) {
return true;
}
else {
return false;
}
}
// this is for enabling login by pressing the ENTER button and signup also just by pressing the enter
document.getElementById("password_login").addEventListener('keydown',function(e){if (e.keyCode == 13){login();}});
</script>
</body>
</html>