-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
45 lines (42 loc) · 835 Bytes
/
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
<?php
session_start();
# process login form
if (isset($_POST["login"])) {
session_unset();
# set user session variables
$_SESSION["user"] = $_POST["user"];
$_SESSION["pass"] = $_POST["pass"];
header("location: index.php");
} else {
# redirect to a home page if user is already signed in
if (isset($_SESSION["user"])) {
header("location: index.php");
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Login</title>
</head>
<body>
<h3>Supply Application Login</h3>
<form method="post" action="login.php">
<p>
<b>User name</b>
</p>
<p>
<input type="text" name="user" required />
</p>
<p>
<b>Password</b>
</p>
<p>
<input type="password" name="pass" required />
</p>
<p>
<input type="submit" name="login" value="Login" />
</p>
</form>
</body>
</html>