-
Notifications
You must be signed in to change notification settings - Fork 1
/
login.php
29 lines (25 loc) · 627 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
<?php
//session_start();
include('config.php');
$error=''; // Variable To Store Error Message
if (isset($_POST['submit'])) {
if (empty($_POST['username']) || empty($_POST['password'])) {
$error = "Username or Password is invalid";
}
else
{
// Define $username and $password
$username=$_POST['username'];
$password=$_POST['password'];
// This can be extended in the future to support a database
// But currently it's overkill
if ( $password == $logins[$username] ) {
$_SESSION['login_user'] = $username;
session_write_close();
}
else {
$error = "Username or Password is invalid";
}
}
}
?>