-
Notifications
You must be signed in to change notification settings - Fork 2
/
login.php
96 lines (86 loc) · 2.74 KB
/
login.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
<?php
include_once('./includes/common.functions.php');
include_once('./includes/login.functions.php');
if(isset($_POST['login']))
{
if(isset($_POST['remember']))
{
setcookie("userEmail",$_POST['userEmail'],time()+ (10 * 365 * 24 * 60 * 60));
setcookie('userPassword',$_POST['password'],time()+ (10 * 365 * 24 * 60 * 60));
}
else
{
$past=time()-100;
if(isset($_COOKIE['userEmail']))
{
setcookie("userEmail","",$past);
}
if(isset($_COOKIE['userPassword']))
{
setcookie('userPassword',"",$past);
}
}
$email=mysqli_real_escape_string($mysqli,$_POST['userEmail']);
$password=mysqli_real_escape_string($mysqli,$_POST['password']);
signin($email,$password);
}
?>
<!DOCTYPE HTML>
<html>
<head>
<title>login</title>
<link rel="stylesheet" href="./styles/bootstrap.css" type="text/css"/>
<link rel="stylesheet" href="./styles/bootstrap_custom.css" type="text/css"/>
<link rel="stylesheet" href="./styles/mainStyle.css" type="text/css"/>
</head>
<body>
<div id="upperPanel">
<?php
include_once('./layout/upperBar.php');
//include_once('./layout/searchPanel.php');
?>
</div>
<div class=" container">
<?php
include_once('./layout/searchPanel.php');
?>
<div class="row">
<div class="col col-md-4 col-md-offset-4">
<div class="panel panel-success">
<div class="panel-heading">
LogIn
</div>
<div class="panel-body">
<form id="loginForm" method="post" action="" class="form">
<div class="form-group alert-warning">
<?php
printError();
printSuccess();
?>
</div>
<div class="form-group">
<input type="email" class="form-control" name="userEmail" placeholder="type your email " <?php if(isset($_COOKIE['userEmail'])){echo 'value="'.$_COOKIE['userEmail'].'"';}?> required />
</div>
<div class="form-group">
<input type="password" class="form-control" name="password" placeholder="type your password " <?php if(isset($_COOKIE['userPassword'])){echo 'value="'.$_COOKIE['userPassword'].'"';}?> required />
</div>
<div class="form-group">
<input type="checkbox" name="remember" <?php if(isset($_COOKIE['userEmail'])){echo 'checked ';}?>/> remember me</div>
<div class="form-group">
<a href="resetPassword.php">forgot password</a></div>
<div class="form-group">
<input type="submit" name="login" value="sign in" class="btn btn-success" />
<input type="button" value="sign up" id="hrefBtn" onclick="location.href='./signup.php'" class="btn btn-primary"/></div>
</form>
</div>
</div>
</div>
</div>
</div>
<?php
include_once('./layout/footerBar.php');
?>
<script type="text/javascript" src="./js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="./js/bootstrap.js"></script>
</body>
</html>