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 C_log extends CI_Controller {
- function __construct(){
- parent::__construct();
- $this->load->model('Panel_model');
- $this->load->library('form_validation');
- }
- function auth(){
- if ($_POST)
- {
- $this->form_validation->set_rules('username','Username'.'required|trim|xss_clean');
- $this->form_validation->set_rules('password','Password'.'required|trim|xss_clean');
- if($this->form_validation->run() == TRUE )
- {
- redirect('backend/home');
- }
- $username = $this->input->post('username');
- $password = md5($this->input->post('password'));
- $auth = $this->Panel_model->login_panel("where username = '$username' and password = '$password'")->result_array();
- if ($auth != NULL){
- $data = array(
- 'username' => $auth[0]['username'],
- 'email' => $auth[0]['email'],
- 'fullname' => $auth[0]['fullname'],
- 'level_user'=> $auth[0]['level_user']
- );
- $this->session->set_userdata('login',$data);
- redirect('backend/home');
- }
- else {
- $this->load->view('backend/error');
- }
- }
- }
- }
- /* End of file C_log.php */
- /* Location: ./application/controllers/C_log.php */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement