Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- defined('BASEPATH') OR exit('No direct script access allowed');
- class BackEndController extends CI_Controller {
- function __construct() {
- parent::__construct();
- $this->load->model('MUser_role');
- }
- public function index()
- {
- if(!$this->MUser_role->isLogin()){
- redirect('login');
- }
- $this->load->view('dashboard');
- }
- public function login()
- {
- if($this->MUser_role->isLogin()){
- redirect(base_url());
- }
- if(!empty($_POST)){
- $user = $this->input->post('username');
- $pass = $this->input->post('password');
- $this->MUser_role->cekLogin($user,$pass);
- $datauser = array(
- 'userId',
- $user,
- $pass
- );
- if (!$datauser){
- die('gagal');
- }else{
- $this->session->set_userdata($datauser);
- redirect(base_url());
- }
- }
- $this->load->view('index');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement