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 Site extends MX_Controller {
- public function __construct(){
- parent::__construct();
- }
- public function index(){
- $this->page->template('login_tpl');
- $this->page->view();
- }
- public function login(){
- $username = $this->input->post('username');
- $pass = $this->input->post('password');
- $password = MD5($pass);
- $src = $this->db->get_where('pengguna', array (
- 'username' => $username,
- 'password' => $password,
- ));
- if ($src->num_rows() == 0) {
- $this->session->set_flashdata('status', 'failed');
- redirect(base_url());
- }
- else {
- $pengguna = $src->row();
- $this->session->set_userdata('pengguna', $pengguna);
- redirect(site_url('/dashboard'));
- }
- }
- public function logout(){
- $this->session->sess_destroy();
- redirect(base_url());
- }
- }
- /* End of file site.php */
- /* Location: ./application/controllers/site.php */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement