Code:
index.php
<!DOCTYPE html><html>
<body>
<center><h1>Login Form</h1>
<?php
if(isset($_POST['submit']))
{
$user=$_POST['username'];
$pass=$_POST['password'];
if($user=="Dominic" && $pass=="toretto")
{
echo "Now you are logged in <br/>";
echo "<a href='logout.php'>logout</a>";
}
else
{
echo "Invalid Username or Password";
}
}
?>
<form method="post" action="index.php">
Username: <input type="text" name="username"/>
Pasword: <input type="password" name="password"/>
<input type="submit" value="Login" name="submit"/>
</form>
</center>
</body>
</html>
logout.php
<!DOCTYPE html>
<html>
<body>
<center>
<h1>Successfully logged out</h1>
</center>
</body>
</html>
<html>
<body>
<center>
<h1>Successfully logged out</h1>
</center>
</body>
</html>
No comments:
Post a Comment