?
Current Path : /home1/savoy/public_html/savoyglobal.net/koolkids/school/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/koolkids/school/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('mastermodel'); } public function login($res="") { if($res=='false') $data['result']='<font color="red" size=2px; >Invalid username / password combination</font>'; else if($res=='logout') $data['result']='<font color="green" size=2px; >Logged out</font>'; else $data['result']=''; $this->load->view('Sessions/login',$data); } public function Forgot_Pass_Fail($status) { if($status=='1') $data['result']='<font color="green" size=2px; >Request Submitted Successfully.</font>'; else if($status=='0') $data['result']='<font color="red" size=2px; >UserName Does Not Exist</font>'; else if($status=='2') $data['result']='<font color="red" size=2px; >Access Denied</font>'; else $data['result']='<font color="red" size=2px; >Unknon Error</font>'; $this->load->view('Sessions/forgot_password',$data); } public function authenticate() { $username=mysql_real_escape_string($this->input->post('username')); $password=mysql_real_escape_string($this->input->post('password')); $data1=$this->mastermodel->authenticate($username,$password); if ($data1['numrows']>0) { $record_list=""; $_SESSION['loggedin']='true'; $_SESSION['userid']=$data1['userid']; $_SESSION['username']=$data1['username']; $_SESSION['currentlogintime']=$data1['clogintime']; $_SESSION['lastid']=$data1['lastid']; $_SESSION['profile_type']=$data1['profile_type']; $_SESSION['attempt']=$data1['attempt']; if($data1['linked_record']!=0) { if($data1['profile_type']=="Parent") { $students=$this->mastermodel->get_data('parent_student',$data1['linked_record'],'parent_id'); foreach($students as $student) { $record_list .= $student['student_id'].","; } $record_list=substr($record_list,0,-1); $_SESSION['related_records']=$record_list; } else { $_SESSION['related_records']=$data1['linked_record']; } } else { $_SESSION['related_records']=""; } redirect('master/index/'); } else { redirect('sessions/login/false'); } } // // function get_post_values() // { // $data = array(); // foreach ($_POST as $key => $value) // { // if($key != "submit") // { // $data[$key] = $this->input->post($key); // } // } // return $data; // } public function forgot_password($res="") { $data['result']=''; $this->load->view('Sessions/forgot_password',$data); } public function Valide_Forgot_Password() { $user=mysql_real_escape_string($this->input->post('username')); $email=mysql_real_escape_string($this->input->post('email')); $no=mysql_real_escape_string($this->input->post('contactno')); $userid = $this->mastermodel->getsinglefieldvalue('user','user_id','username',$user); if($userid=="") { redirect('sessions/Forgot_Pass_Fail/0'); } else if($userid=='1') { redirect('sessions/Forgot_Pass_Fail/2'); } else { $this->db->trans_begin(); $tbl1Values=array('username'=>$user, 'email'=>$email, 'contactno'=>$no, 'time'=> date("Y-m-d H:i:s"), 'status'=> '0'); $this->db->insert('forgot_password', $tbl1Values); $this->db->trans_commit(); redirect('sessions/Forgot_Pass_Fail/1'); } } public function logout() { session_destroy(); redirect('sessions/login/logout'); } /*public function viewattempts($name,$id) { $data['single']=$this->user->view_attempt($name,$id); $this->load->view('Home/viewattempt_page',$data); }*/ } ?>