Advertisement
Guest User

Untitled

a guest
May 6th, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3.  
  4. class BackEndController extends CI_Controller {
  5.  
  6. function __construct() {
  7. parent::__construct();
  8. $this->load->model('MUser_role');
  9. }
  10.  
  11. public function index()
  12. {
  13. if(!$this->MUser_role->isLogin()){
  14. redirect('login');
  15. }
  16. $this->load->view('dashboard');
  17. }
  18.  
  19. public function login()
  20. {
  21. if($this->MUser_role->isLogin()){
  22. redirect(base_url());
  23. }
  24.  
  25. if(!empty($_POST)){
  26.  
  27. $user = $this->input->post('username');
  28. $pass = $this->input->post('password');
  29.  
  30. $this->MUser_role->cekLogin($user,$pass);
  31. $datauser = array(
  32. 'userId',
  33. $user,
  34. $pass
  35. );
  36.  
  37. if (!$datauser){
  38. die('gagal');
  39. }else{
  40. $this->session->set_userdata($datauser);
  41. redirect(base_url());
  42. }
  43.  
  44. }
  45.  
  46. $this->load->view('index');
  47. }
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement