![]() |
|
Example:
HTML
<form action="login.php" method="post" name="Login_Form"> <table width="400" border="0" align="center" cellpadding="5" cellspacing="1" class="Table"> <?php if(isset($msg)){?> <tr> <td colspan="2" align="center" valign="top"><?php echo $msg;?></td> </tr> <?php } ?> <tr> <td colspan="2" align="left" valign="top"><h3>Login</h3></td> </tr> <tr> <td align="right" valign="top">Username</td> <td><input name="Username" type="text" class="Input"></td> </tr> <tr> <td align="right">Password</td> <td><input name="Password" type="password" class="Input"></td> </tr> <tr> <td> </td> <td><input name="Submit" type="submit" value="Login" class="Button3"></td> </tr> </table>
</form>
Example:
PHP
<?php session_start(); /* Starts the session */
if(!isset($_SESSION['UserData']['Username'])){ header("location:login.php"); exit;
}
?>
Congratulation! You have logged into password protected page. <a href="logout.php">Click here</a> to Logout.
Example:
PHP
<?php session_start(); /* Starts the session */
session_destroy(); /* Destroy started session */
header("location:login.php"); /* Redirect to login page */
exit;
?>
How to Login Without Database | PHP Login Tutorial |
Create HTML Login form | PHP Login Tutorial |
Now, Create Login redirect Page | PHP Login Tutorial |
Finally, Create a pgae to logout | PHP Login Tutorial |
Category
: |
Web Tutorial |
Sub Category
: |
PHP Login Tutorial |
Uploaded by
: |
Admin |
Read Article https://horje.com/learn/1434/reference