-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
81 lines (71 loc) · 2.52 KB
/
index.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
<html>
<head>
<meta charset="UTF-8">
<title>Login</title>
<meta name="description" content="Login">
<meta name="author" content="Lorenzo Angelino aka MrLolok">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="main.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<style>
body {
background-color: white;
}
</style>
</head>
<body>
<div id="container-login">
<div id="title">
<i class="material-icons lock">lock</i> Login
</div>
<?php if(isset($err)){ echo $err; } ?>
<form method="post" target="_self">
<div class="input">
<div class="input-addon">
<i class="material-icons">face</i>
</div>
<input id="username" placeholder="Email Id" type="text" name="email" required class="validate" autocomplete="off">
</div>
<div class="clearfix"></div>
<div class="input">
<div class="input-addon">
<i class="material-icons">vpn_key</i>
</div>
<input id="password" placeholder="Password" type="password" name="pwd" required class="validate" autocomplete="off">
</div>
<div class="remember-me">
<input type="checkbox">
<span style="color: #DDD">Remember Me</span>
</div>
<input type="submit" name="login" value="Log In" />
</form>
<?php
session_start(); // Session start
if(isset($_POST['login'])) // Check form submit with IF Isset function
{
$username="admin"; // set variable value
$password="123"; // set variable value
if($_POST['email']==$username && $_POST['pwd']==$password) // Check Given user name, password and Variable user name password are same
{
$_SESSION['username']=$username; // set session from given user name
header('location:mainpage.php');
}
else
{
header('location:invalid.php');
}
}
?>
<div class="forgot-password">
<a href="#">Forgot your password?</a>
</div>
<div class="privacy">
<a href="#">Privacy Policy</a>
</div>
<div class="register">
Don't have an account yet?
<a href="/register.html"><button id="register-link">Register here</button></a>
</div>
</div>
</body>
</html>