?
Current Path : /home1/savoy/public_html/savoyglobal.net/gea/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/gea/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'); } public function login($res="") { if($res=='false') $data['result']='<font color="red" size=1px; >Username and Password does not match</font>'; else $data['result']=''; $this->load->view('sessions/login',$data); } public function authenticate() { $username=$this->input->post('username'); $password=$this->input->post('password'); $login_type=$this->input->post('login_type'); $username=mysql_real_escape_string($username); $password=mysql_real_escape_string($password); $data1=$this->mastermodel->authenticate($username,$password); if ($data1['numrows']>0) { $_SESSION['loggedin']='true'; $_SESSION['user_id']=$data1['user_id']; $_SESSION['login_type']=$login_type; $_SESSION['employee_id']=$data1['employee_id']; $employee=$this->mastermodel->get_data_srow_joined('employee','master','employee_id','master_id',$data1['employee_id'],'employee_id'); $_SESSION['username']=$data1['username']; $_SESSION['user_type']=$data1['user_type']; $_SESSION['employee_branch_id']=$employee->branch_id; $_SESSION['currentlogintime']=$data1['clogintime']; $_SESSION['lastid']=$data1['lastid']; $_SESSION['attempt']=$data1['attempt']; $_SESSION['pagenum']=1; redirect('master/index/'); } else { redirect('sessions/login/false'); } } public function customer_authenticate($username,$password) { $username=mysql_real_escape_string($username); $password=mysql_real_escape_string($password); $data=$this->adminmodel->authenticate($username,$password); if ($data['numrows']>0) { $_SESSION['loggedin']='true'; $_SESSION['customer_id']=$data['customer_id']; $_SESSION['customer_login_name']=$data['customer_login_name']; redirect('admin/home/'); } else { echo "<script type='text/javascript'>alert('Wrong login details')</script>"; echo "<script type='text/javascript'>document.location.href='http://www.otscargo.com';</script>"; } } public function logout() { session_destroy(); redirect('sessions/login'); } public function relogin() { if($_SESSION['login_type']==1) $_SESSION['login_type'] = 0; else $_SESSION['login_type'] = 1; redirect('master/index/'); } } ?>