Skip to content

Commit

Permalink
Add a query so that login page should not appear till click on logout…
Browse files Browse the repository at this point in the history
… button.
  • Loading branch information
Gaurav Gupta committed Mar 6, 2023
1 parent 2d98e58 commit 6e387ac
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,23 @@
<link rel="stylesheet" href="index_style.css">
</head>
<body>
<?php if ($_SESSION['logged_in'] == false){?>
<form action="login.php" method="post">
<label for="username">Username:</label>
<input type="text" id="username" name="username">
<label for="password">Password:</label>
<input type="password" id="password" name="password">
<input type="submit" value="Login">
<?php if ($error === 'invalid_id_password'): ?>
<p class="error-message">Invalid username or password</p>
<?php endif; ?>
</form>
<?php }
else if($_SESSION['logged_in'] == true){
header('Location: pager_index.php');
}
?>


<form action="login.php" method="post">
<label for="username">Username:</label>
<input type="text" id="username" name="username">
<label for="password">Password:</label>
<input type="password" id="password" name="password">
<input type="submit" value="Login">
<?php if ($error === 'invalid_id_password'): ?>
<p class="error-message">Invalid username or password</p>
<?php endif; ?>
</form>

</body>
</html>

0 comments on commit 6e387ac

Please sign in to comment.