Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class C_login extends CI_Controller {
- function __construct() {
- parent::__construct();
- $this->load->model('m_login');
- }
- function index() {
- $this->load->view('v_login');
- }
- function aksi_login() {
- $user = $this->input->post('user');
- $pass = $this->input->post('pass');
- $where = array(
- 'user' => $user,
- 'pass' => md5($pass)
- );
- $cek = $this->m_login->cek_login("t_user", $where)->num_rows();
- if ($cek > 0) {
- $data_session = array(
- 'nama' => $user,
- 'status' => "login"
- );
- $this->session->set_userdata($data_session);
- redirect(base_url("c_home"));
- } else {
- $data["error"] = "Username dan Password Salah";
- $this->load->view('v_login', $data);
- //redirect(base_url("c_login"));
- }
- }
- function logout() {
- $this->session->sess_destroy();
- redirect(base_url("c_login"));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement