Guest User

Untitled

a guest
Aug 4th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. <div class="alert alert-danger <?php if(!isset($error)) echo 'hide';?>">
  2. Invalid username/password! Email administrator in link below to recover it.
  3. </div>
  4. <div class="alert alert-warning <?php if(!isset($inactive)) echo 'hide';?>">
  5. This account is no longer valid. Thank you!
  6. </div>
  7. <div style="display:none" id="login-alert" class="alert alert-danger col-sm-12"></div>
  8.  
  9. <?php
  10. include('connection.php');
  11. if (isset($_POST['proceed'])) {
  12. $username = $_POST['login'];
  13. $password = $_POST['password'];
  14. /***** GUIDANCE *****/
  15. $guidance = "SELECT * FROM faculty WHERE Faculty_ID = ? AND Password = ? AND Position='Guidance' ";
  16. $stmt = $conn->prepare($guidance);
  17. $stmt->bind_param('is', $username, $password);
  18. $stmt->execute();
  19. $result = $stmt->get_result();
  20.  
  21.  
  22.  
  23. $student = "SELECT * FROM student WHERE Student_ID = ? AND Password = ? ";
  24. $stmt = $conn->prepare($student);
  25. $stmt->bind_param('is', $username, $password);
  26. $stmt->execute();
  27. $result2 = $stmt->get_result();
  28. if ($result -> num_rows > 0) {
  29.  
  30. $row = $result -> fetch_object();
  31. if($row->Status!='Active'){
  32. $inactive = 1;
  33. }else{
  34. $_SESSION['access'] = 1;
  35. $_SESSION['login'] = $row -> Faculty_ID;
  36. $_SESSION['Faculty_Firstname'] = $row -> Faculty_Firstname;
  37. header('Location: guidance/index.php');
  38. }
  39. elseif ($result2 -> num_rows > 0) {
  40.  
  41. $row = $result2 -> fetch_object();
  42. $_SESSION['access'] = 3;
  43. $_SESSION['Student_ID'] = $row -> Student_ID;
  44. //$_SESSION[] = $row ->
  45. header('Location:student/index.php ');
  46. }else{
  47. $error = 1;
  48. }
  49. }
  50. ?>
Add Comment
Please, Sign In to add comment