Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form class="form-signin" method="POST" action="/authenticate">
- <h2 class="form-signin-heading">Please sign in</h2>
- <label for="inputEmail" class="sr-only">Username</label>
- <input type="text" id="inputEmail" name="username" class="form-control" placeholder="Username" required="" autofocus="">
- <label for="inputPassword" class="sr-only">Password</label>
- <input type="password" id="inputPassword" name="password" class="form-control" placeholder="Password" required="">
- <button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
- </form>
- class LoginController extends Controller
- {
- function render()
- {
- $template=new Template;
- $this->f3->set('page_head','Log In'); //from variable page_head from another template
- $this->f3->set('view','login/login.htm');
- }
- function beforeroute()
- {
- }
- function authenticate()
- {
- $username = $this->f3->get('POST.username');
- $password = $this->f3->get('POST.password');
- $user = new Login($this->db);
- $user->getByName($username);
- if($user->dry()) {
- echo 'No Matched Username';
- }
- }
- }
- public function getByName($name)
- {
- $this->load(array('username=?', $name));
- }
- $f3=require('lib/base.php');
- $f3->config('config/config.ini');
- $f3->route('GET|POST /login' , 'LoginController->render');
- $f3->route('POST /authenticate' , 'LoginController->authenticate');
- $f3->run();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement