PageRenderTime 127ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/app/controllers/admincp/login.php

https://bitbucket.org/nanomites_webdev/heroframework
PHP | 46 lines | 29 code | 8 blank | 9 comment | 3 complexity | bc7569dbf5b2f29ae2f9d14f4846760d MD5 | raw file
Possible License(s): LGPL-2.1, BSD-3-Clause, GPL-2.0
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2. /**
  3. * Admincp Login Controller
  4. *
  5. * Log the administrator in and out of the dashboard.
  6. *
  7. * @copyright Electric Function, Inc.
  8. * @author Electric Function, Inc.
  9. * @package Hero Framework
  10. */
  11. class Login extends CI_Controller {
  12. function __construct() {
  13. parent::__construct();
  14. $this->load->model('admincp/notices');
  15. $this->load->helper('admincp/get_notices');
  16. $this->load->helper('ssl');
  17. }
  18. function index() {
  19. $this->load->view(branded_view('cp/login.php'));
  20. }
  21. function go() {
  22. if ($this->user_model->login($this->input->post('username'),$this->input->post('password'))) {
  23. $this->notices->SetNotice("You have logged in successfully.");
  24. redirect('/admincp');
  25. return TRUE;
  26. }
  27. else {
  28. $this->notices->SetError('Your login credentials were incorrect.');
  29. redirect('/admincp/login');
  30. return FALSE;
  31. }
  32. }
  33. function logout () {
  34. $this->user_model->logout();
  35. redirect('admincp');
  36. return TRUE;
  37. }
  38. }