Advertisement
Guest User

Untitled

a guest
Apr 20th, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. <form class="form-signin" method="POST" action="/authenticate">
  2. <h2 class="form-signin-heading">Please sign in</h2>
  3. <label for="inputEmail" class="sr-only">Username</label>
  4. <input type="text" id="inputEmail" name="username" class="form-control" placeholder="Username" required="" autofocus="">
  5. <label for="inputPassword" class="sr-only">Password</label>
  6. <input type="password" id="inputPassword" name="password" class="form-control" placeholder="Password" required="">
  7. <button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
  8. </form>
  9.  
  10. class LoginController extends Controller
  11. {
  12.  
  13. function render()
  14. {
  15. $template=new Template;
  16. $this->f3->set('page_head','Log In'); //from variable page_head from another template
  17. $this->f3->set('view','login/login.htm');
  18.  
  19. }
  20.  
  21. function beforeroute()
  22. {
  23. }
  24.  
  25. function authenticate()
  26. {
  27. $username = $this->f3->get('POST.username');
  28. $password = $this->f3->get('POST.password');
  29.  
  30. $user = new Login($this->db);
  31. $user->getByName($username);
  32.  
  33. if($user->dry()) {
  34. echo 'No Matched Username';
  35. }
  36.  
  37.  
  38.  
  39. }
  40. }
  41.  
  42. public function getByName($name)
  43. {
  44. $this->load(array('username=?', $name));
  45. }
  46.  
  47. $f3=require('lib/base.php');
  48. $f3->config('config/config.ini');
  49. $f3->route('GET|POST /login' , 'LoginController->render');
  50. $f3->route('POST /authenticate' , 'LoginController->authenticate');
  51.  
  52. $f3->run();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement