Simple PHP Login Page is for beginners to create simple login page with basic logics. In this example the user can enter login id and password. If it is valid then the system redirects to main page else it displays alert message. Default Login Id is studentprojectguide and password is password.

<?php
//If entered Login details valid then it redirects to
//main page..
if(isset($_POST["Submit"]))
{
if($_POST["loginid"] == "studentprojectguide" && $_POST["password"] == "password")
{
echo "<script>alert('Logged in successfully...');</script>";
echo "<script>window.location='main.php';</script>";
}
else
{
echo "<script>alert('Failed to Login..');</script>";
}
}
?>
<html>
<head>
<title>Login Panel</title>
<head>
<body>
<form method="post" action="" >
<table>
<tr>
<td>Login ID:</td><td><input type="text" name="loginid" ></td>
</tr>
<tr>
<td>Password:</td><td><input type="password" name="password"></td>
</tr>
<tr>
<td colspan="2">
<center><input type="submit" name="Submit" value="Click here to Login"></center>
</td>
</tr>
</table>
</form>
</body>
</html>