?
Current Path : /home1/savoy/public_html/savoyglobal.net/sec/application/controllers/ |
Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 |
Current File : /home1/savoy/public_html/savoyglobal.net/sec/application/controllers/sessions.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');?> <?php class Sessions extends CI_Controller { public function __construct() { parent::__construct(); session_start(); $this->load->model('mastermodel'); // $this->load->model('adminmodel'); } public function login($res="") { if(!isset($_SESSION['login_msg'])){ $_SESSION['login_msg']='Username and Password does not match'; } if($res=='false') $data['result']='<font color="red" size=1px; >'.$_SESSION['login_msg'].'</font>'; else $data['result']=''; $this->load->view('sessions/login',$data); } public function authenticate() { $data = array(); $user_name = $this->input->post('user_name'); $password = $this->input->post('password'); $user_name = mysql_real_escape_string($user_name); $password = mysql_real_escape_string($password); $data = $this->mastermodel->authenticate($user_name, $password); // var_dump($data); if ($data['numrows'] > 0) { $_SESSION['loggedin'] = 'true'; $_SESSION['user_id'] = $data['user_id']; $_SESSION['user_name'] = $user_name; $_SESSION['pagenum'] = 1; $_SESSION['employee_id'] = $data['employee_id']; $_SESSION['modules_permission'] = $data['modules_permission']; $_SESSION['user_modules'] = $data['user_modules']; redirect('master/index/'); } else { redirect('sessions/login/false'); } } public function logout() { session_destroy(); redirect('sessions/login'); } } ?>