Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Login_dsn extends CI_Controller {
- public function __construct()
- {
- parent::__construct();
- $this->load->model( 'Login_dsn_model', '', TRUE );
- }
- function login_dsn()
- {
- //$this->load->model( 'Login_dsn_model', '', TRUE );
- }
- function index()
- {
- if ($this->session->userdata ( 'login_dsn' ) == TRUE)
- {
- redirect ( 'home_dsn' );
- }
- else
- {
- $this->load->view ( 'login_dsn_view' );
- }
- }
- function process_login_dsn()
- {
- $this->form_validation->set_rules('id_dsn', 'Username Ptg', 'required');
- $this->form_validation->set_rules('pass_dsn', 'Password Ptg', 'required');
- if ($this->form_validation->run() == TRUE)
- {
- $id_dsn = $this->input->post('id_dsn');
- $pass_dsn = $this->input->post('pass_dsn');
- if ($this->Login_dsn_model->check_id_dsn($id_dsn, $pass_dsn) == TRUE)
- {
- $data = array('id_dsn' => $id_dsn, 'login_dsn' => TRUE);
- $this->session->set_userdata($data);
- redirect('home_dsn');
- }
- else
- {
- $this->session->set_flashdata('message', 'Maaf, username dan atau password Anda salah');
- redirect('login_dsn/index');
- }
- }
- else
- {
- $this->load->view('login_dsn_view');
- }
- }
- /**
- * Memproses logout
- */
- function process_logout_dsn()
- {
- $this->session->sess_destroy();
- redirect('login_dsn', 'refresh');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement