D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
ksclnmuac
/
www
/
cas
/
application
/
controllers
/
student
/
Filename :
Authentication.php
back
Copy
<?php /** * Login/Logout Authentication For Students * * @author Softpro India Pvt. Ltd. */ defined('BASEPATH') OR exit('No direct script access allowed'); class Authentication extends CI_Controller { public function __construct() { parent::__construct(); $this->load->model('student/StudentAuthenticator'); } public function index() { if ($this->sessionvalidator->isStudentLoggedIn()) { redirect("student/Dashboard"); } else { $this->load->view('student/login'); } } public function authLogin() { $this->form_validation->set_rules("rollEnrlNo", "Roll Number/College ID", "trim|required", array("required" => "Roll Number/Enrollment No./Form Id Can Not Be Blank.")); $this->form_validation->set_rules("password", "Password", "trim|required", array("required" => "Password Can Not Be Blank.")); if ($this->form_validation->run() == FALSE) { $this->index(); } else { $loginResponse = $this->StudentAuthenticator->authLogin($this->input->post('rollEnrlNo'), MD5($this->input->post('password'))); if (gettype($loginResponse) == "string") { $this->session->set_flashdata('errorMessage', $loginResponse); $this->index(); } else { if ($loginResponse) { redirect("student/Dashboard"); } else { $this->session->set_flashdata('errorMessage', 'Invalid Roll Number/Enrollment No./Form Id/ Or Password'); $this->index(); } } } } public function authLogout() { $this->StudentAuthenticator->authLogout(); redirect("student/"); } }