30 lines
753 B
PHP
30 lines
753 B
PHP
<?php
|
|
session_start();
|
|
if (isset($_COOKIE['login_time']) && isset($_COOKIE['username'])) {
|
|
header("Location: welcome.php");
|
|
exit();
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="">
|
|
<head>
|
|
<title>Login</title>
|
|
</head>
|
|
<body>
|
|
<?php if (isset($_GET['error'])): ?>
|
|
<p style="color: red;">
|
|
<?php
|
|
if ($_GET['error'] === 'invalid') echo "Invalid credentials!";
|
|
if ($_GET['error'] === 'expired') echo "Session expired!";
|
|
?>
|
|
</p>
|
|
<?php endif; ?>
|
|
|
|
<form action="do_login.php" method="post">
|
|
Username: <input type="text" name="username"><br>
|
|
Password: <input type="password" name="password"><br>
|
|
<input type="submit" value="Login">
|
|
</form>
|
|
</body>
|
|
</html>
|