?
Current Path : /home1/savoy/www/savoyglobal.net/piadraft/system/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/www/savoyglobal.net/piadraft/system/application/controllers/sessions.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');?> <?php class Sessions extends Controller { public function __construct() { parent::__construct(); session_start(); $this->load->model('user'); $this->load->model('mastermodel'); } public function login($res="") { if($res=='false') $data['result']='<font color="red" size=2px; >Username and Password does not match</font>'; else $data['result']=''; $this->load->view('sessions/login',$data); //redirect('sessions/login',$data); } public function authenticate() { $this->load->model('user'); $username=$this->input->post('username'); $password=$this->input->post('password'); $username=mysql_real_escape_string($username); $password=mysql_real_escape_string($password); $data1=$this->user->authenticate($username,$password); if ($data1['numrows']>0) { $_SESSION['loggedin']='true'; $_SESSION['userid']=$data1['userid']; $_SESSION['username']=$data1['username']; $_SESSION['currentlogintime']=$data1['clogintime']; $_SESSION['lastid']=$data1['lastid']; $_SESSION['roleid']=$data1['roleid']; $_SESSION['staffid']=$data1['staffid']; $staff_list=$data1['staffid'].','; $employees=$this->mastermodel->traceemployee($data1['staffid'],$staff_list); $_SESSION['employees']=$employees; $_SESSION['attempt']=$data1['attempt']; redirect('master/index/'); } else { redirect('sessions/login/false'); } } public function logout() { session_destroy(); redirect('sessions/login'); } public function viewattempts($name,$id) { $data['single']=$this->user->view_attempt($name,$id); $this->load->view('Home/viewattempt_page',$data); } } ?>