Guest User

Untitled

a guest
Nov 20th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. <form action="login.php" method="post">
  2. <div class="containerLogin">
  3. <label><b>Username</b></label>
  4. <input type="text" placeholder="Enter Username"name="username" required>
  5.  
  6. <label><b>Password</b></label>
  7. <input type="password" placeholder="Enter Password" name="password" required>
  8. </div>
  9.  
  10. <div class="containerLogin" style="background-color:#f1f1f1">
  11. <input type="submit" name="submit" value="submit" class="btn btn-primary">
  12. <span class="password">Forgot <a href="#">password?</a></span>
  13. </div>
  14. </form>
  15.  
  16. <?php
  17. include_once "connection.php";
  18. if (isset($_POST['submit'])) {
  19. session_start();
  20. if($_POST['username'] && $_POST['password']) {
  21. $username = $_POST['username'];
  22. $password = $_POST['password'];
  23. $query = mysqli_query("SELECT * FROM studenttable WHERE username='$username' and password='$password'");
  24. $res = mysqli_query($con, $query);
  25. $count_user = mysqli_num_rows($res);
  26. if($count_user==1)
  27. {
  28. $row = mysqli_fetch_array($res);
  29. $_SESSION['username'] = $row['username'];
  30. $_SESSION['password'] = $row['password'];
  31. header("location:dashboard.php?success=1");
  32. }else{
  33. $error = 'Incorrect Username, Password and Branch.';
  34. }
  35. }
  36. }
  37. ?>
Add Comment
Please, Sign In to add comment