D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
ksclnmuac
/
www
/
grievance
/
sys_admin
/
application
/
controllers
/
admin
/
Filename :
Authentication.php
back
Copy
<?php /** * Authentication Login/Logout Controller For Admin * * @author Softpro India Pvt. Ltd. */ defined('BASEPATH') OR exit('No direct script access allowed'); class Authentication extends CI_Controller { public function __construct() { parent::__construct(); $this->load->helper('url'); $this->load->helper('form'); $this->load->library('form_validation'); $this->load->library('session'); $this->load->model("admin/AdminAuthenticator"); } public function index(){ if($this->session->userdata('logged_in')){redirect("admin/Dashboard");}else{$this->load->view('admin/sign_in');} } public function authLogin(){ $this->form_validation->set_rules('username', 'Username', 'trim|required', array('required' => 'Username Is Required.')); $this->form_validation->set_rules('password', 'Password', 'required', array('required' => 'Password Can Not Be Blank.')); if ($this->form_validation->run() == FALSE) { $this->index(); } else { $result = $this->AdminAuthenticator->authLogin($this->input->post('username'),$this->input->post('password')); if($result){redirect("admin/Dashboard");}else{$data['message'] = 'Invalid Username Or Password';$this->load->view('admin/sign_in',$data);} } } public function authLogout(){ $this->AdminAuthenticator->authLogout(); $this->index(); } }