Simple Login In PHP Without A Database (ok)
https://www.youtube.com/watch?v=C_Q33tOWejw
C:\xampp\htdocs\code\index.php
<?php
session_start();
if(!$_SESSION['user']) {
header("Location: login.php");
exit();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<p>Wellcome Home Page</p>
<form action="protect.php" method="post">
<input type="hidden" name="logout" value="1"/>
<input type="submit" value="Logout"/>
</form>
</body>
</html>C:\xampp\htdocs\code\check.php
C:\xampp\htdocs\code\login.php
C:\xampp\htdocs\code\protect.php
C:\xampp\htdocs\code\login.css


Last updated
Was this helpful?