Guest User

Untitled

a guest
May 13th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. <?php
  2. include "phpincludes/config.php";
  3.  
  4. // If they are logged in, forward to main.php
  5. if($student->logged_in()) {
  6. redirectTo("main.php");
  7. }
  8.  
  9. // Form Submitted?
  10. if(isset($_POST["submit"])){
  11. $account_type = get_request('account_type');
  12. $username = get_request('username');
  13. $password = get_request('password');
  14.  
  15. // It's setup to handle multiple account types. Let's just assume student is the only one
  16. switch($account_type) {
  17. case 'student':
  18. $u = new Student;
  19. $u->auth($_POST['username'], $_POST['password']);
  20. redirectTo("main.php");
  21. break;
  22. }
  23. }
  24.  
  25. siteheader("Flight 1", "Welcome");
  26. ?>
  27.  
  28. <div id="main">
  29. <h3>Please Login</h3>
  30. <form action="index.php" method="post">
  31. <p><label>Account Type: </label>
  32. <select name="account_type">
  33. <option value="student">Student</option>
  34. <option value="instructor">Instructor</option>
  35. <option value="admin">Admin</option>
  36. </select>
  37. </p>
  38. <p><label for="username">Username :</label><input type="text" name="username" placeholder="Username"/></p>
  39. <p><label for="password">Password :</label><input type="text" name="password" placeholder="Password"/></p>
  40. <input type="submit" value="Submit" name="submit" />
  41. </form>
  42. </div>
  43.  
  44. <?php
  45. sitefooter();
  46. ?>
Add Comment
Please, Sign In to add comment