Breaking

Monday, July 9, 2018

Creat A Welcome.php After Creating Login Form


So Friend This The Basic Coding After Creating Login Form, When user login with their username or password,

The we have set a session, if user want to access Login Form or Signup Form then he can't access, because the use have session,

When user destroy the session after clicking on LOGOUT button, the he can access Login And Signup Form, And now he can't access welcome.php,

Because the user haven't any session, to start the session user need to Login their account.


<?php
// lets write an code, if user haven't any session then redirecting it to back login form ... ok


session_start();

if(isset($_SESSION['uname'])) // ohh the error was here.. $_POST is wrong.. we need to user session
{
}
else
{
header("LOCATION:login.php");
exit();
}

$name = $_SESSION['uname'];

?>
<h3>
<div align="right">
<a href="logout.php">Logout</a>
</div>
</h3>
<h1 align="center">
<?php
echo "Hello," .$name." "."Your Most Welcome";

// let's checking  that can we access login form after login succesful... ohh we find a bug lets fix it
?>

</h1>

No comments:

Post a Comment