Skip to content

Commit

Permalink
Login Form bug not fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Fahad-Md-Kamal committed Mar 13, 2019
1 parent 5a9a95c commit a55417d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 14 deletions.
43 changes: 33 additions & 10 deletions login.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,29 @@

<div class="row justify-content-center">

<div class="col-lg-6 bg-dark text-light pb-5 pt-5">
<div class="col-lg-6 pb-5 pt-5">

<?php
if(!isset($_COOKIE['loginCounter'])) { ?>


















<?php
if(!isset($_COOKIE['cookie'])) {
?>

<form action="php/loginChecker.php" method="post">
<legend class="text-center text-uppercase">User Login</legend>
Expand All @@ -32,17 +51,21 @@
<div class="form-group">
<input type="submit" class="form-control btn btn-success mt-4" value="SUBMIT">
</div>
<p class="h4 text-center">

</form>

<?php } else {
echo "yeah it is set";
}

<?php if (isset($_SESSION['msg'])) {
if (isset($_SESSION['msg'])) {
echo $_SESSION['msg']. '<br>'.$_SESSION['count'];
unset($_SESSION['msg']);
} ?></p>
</form>
} ?>




<?php }else {
echo "get lost";
} ?>


</div>
Expand Down
7 changes: 3 additions & 4 deletions php/loginChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@
$_SESSION['userName']= $userName = $row['name'];
}
$_SESSION['loggedIn'] = true;
$_SESSION['msg'] = "Hey<br> $userName <br>Welcome Back ";
$_SESSION['msg'] = "$userName <br>Welcome Back ";
unset($_SESSION['count']);
}else{
$_SESSION['msg'] = "Invalid Username or Password";
$_SESSION['count']++;

if($_SESSION['count'] >= 3){
setcookie('loginCounter', true, time() + 10);
setcookie('cookie', true, time() + 10);
}
$_SESSION['msg'] = "Invalid Username or Password";
}
}
header("location:../login.php");
Expand Down

0 comments on commit a55417d

Please sign in to comment.