REDROOM
PHP 8.1.33
Path:
Logout
Edit File
Size: 7.09 KB
Close
/home/jambtst2015/public_html/eschoolengine Installer/application/controllers/Login.php
Text
Base64
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); /* * @author : Joyonto Roy * 30th July, 2014 * Creative Item * www.creativeitem.com * http://codecanyon.net/user/joyontaroy */ class Login extends CI_Controller { function __construct() { parent::__construct(); $this->load->model('crud_model'); $this->load->database(); $this->load->library('session'); /* cache control */ $this->output->set_header('Last-Modified: ' . gmdate("D, d M Y H:i:s") . ' GMT'); $this->output->set_header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); $this->output->set_header('Pragma: no-cache'); $this->output->set_header("Expires: Mon, 26 Jul 2010 05:00:00 GMT"); } //Default function, redirects to logged in user area public function index() { if ($this->session->userdata('admin_login') == 1) redirect(base_url() . 'index.php?admin/dashboard', 'refresh'); if ($this->session->userdata('teacher_login') == 1) redirect(base_url() . 'index.php?teacher/dashboard', 'refresh'); if ($this->session->userdata('student_login') == 1) redirect(base_url() . 'index.php?student/dashboard', 'refresh'); if ($this->session->userdata('parent_login') == 1) redirect(base_url() . 'index.php?parents/dashboard', 'refresh'); $this->load->view('backend/login'); } //Ajax login function function ajax_login() { $response = array(); //Recieving post input of email, password from ajax request $email = $_POST["email"]; $password = sha1($_POST["password"]); $response['submitted_data'] = $_POST; //Validating login $login_status = $this->validate_login($email, $password); $response['login_status'] = $login_status; if ($login_status == 'success') { $response['redirect_url'] = ''; } //Replying ajax request with validation response echo json_encode($response); } //Validating login from ajax request function validate_login($email = '', $password = '') { $credential = array('email' => $email, 'password' => $password); // Checking login credential for admin $query = $this->db->get_where('admin', $credential); if ($query->num_rows() > 0) { $row = $query->row(); $this->session->set_userdata('admin_login', '1'); $this->session->set_userdata('admin_id', $row->admin_id); $this->session->set_userdata('login_user_id', $row->admin_id); $this->session->set_userdata('name', $row->name); $this->session->set_userdata('login_type', 'admin'); return 'success'; } // Checking login credential for teacher $query = $this->db->get_where('teacher', $credential); if ($query->num_rows() > 0) { $row = $query->row(); $this->session->set_userdata('teacher_login', '1'); $this->session->set_userdata('teacher_id', $row->teacher_id); $this->session->set_userdata('login_user_id', $row->teacher_id); $this->session->set_userdata('name', $row->name); $this->session->set_userdata('login_type', 'teacher'); return 'success'; } // Checking login credential for student $query = $this->db->get_where('student', $credential); if ($query->num_rows() > 0) { $row = $query->row(); $this->session->set_userdata('student_login', '1'); $this->session->set_userdata('student_id', $row->student_id); $this->session->set_userdata('login_user_id', $row->student_id); $this->session->set_userdata('name', $row->name); $this->session->set_userdata('login_type', 'student'); return 'success'; } // Checking login credential for parent $query = $this->db->get_where('parent', $credential); if ($query->num_rows() > 0) { $row = $query->row(); $this->session->set_userdata('parent_login', '1'); $this->session->set_userdata('parent_id', $row->parent_id); $this->session->set_userdata('login_user_id', $row->parent_id); $this->session->set_userdata('name', $row->name); $this->session->set_userdata('login_type', 'parent'); return 'success'; } return 'invalid'; } /* * *DEFAULT NOR FOUND PAGE**** */ function four_zero_four() { $this->load->view('four_zero_four'); } // PASSWORD RESET BY EMAIL function forgot_password() { $this->load->view('backend/forgot_password'); } function ajax_forgot_password() { $resp = array(); $resp['status'] = 'false'; $email = $_POST["email"]; $reset_account_type = ''; //resetting user password here $new_password = substr( md5( rand(100000000,20000000000) ) , 0,7); // Checking credential for admin $query = $this->db->get_where('admin' , array('email' => $email)); if ($query->num_rows() > 0) { $reset_account_type = 'admin'; $this->db->where('email' , $email); $this->db->update('admin' , array('password' => sha1($new_password))); $resp['status'] = 'true'; } // Checking credential for student $query = $this->db->get_where('student' , array('email' => $email)); if ($query->num_rows() > 0) { $reset_account_type = 'student'; $this->db->where('email' , $email); $this->db->update('student' , array('password' => sha1($new_password))); $resp['status'] = 'true'; } // Checking credential for teacher $query = $this->db->get_where('teacher' , array('email' => $email)); if ($query->num_rows() > 0) { $reset_account_type = 'teacher'; $this->db->where('email' , $email); $this->db->update('teacher' , array('password' => sha1($new_password))); $resp['status'] = 'true'; } // Checking credential for parent $query = $this->db->get_where('parent' , array('email' => $email)); if ($query->num_rows() > 0) { $reset_account_type = 'parent'; $this->db->where('email' , $email); $this->db->update('parent' , array('password' => sha1($new_password))); $resp['status'] = 'true'; } // send new password to user email $this->email_model->password_reset_email($new_password , $reset_account_type , $email); $resp['submitted_data'] = $_POST; echo json_encode($resp); } /* * *****LOGOUT FUNCTION ****** */ function logout() { $this->session->sess_destroy(); $this->session->set_flashdata('logout_notification', 'logged_out'); redirect(base_url(), 'refresh'); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 13
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
.DS_Store
6.00 KB
lrwxrwxrwx
2024-11-22 17:53:15
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Admin.php
94.87 KB
lrwxrwxrwx
2024-11-22 17:53:15
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
index.html
131 B
lrwxrwxrwx
2024-11-22 17:53:15
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Install.php
484 B
lrwxrwxrwx
2024-11-22 17:53:15
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Login.php
7.09 KB
lrwxrwxrwx
2024-11-22 17:53:15
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Mobile.php
29.60 KB
lrwxrwxrwx
2024-11-22 17:53:15
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Modal.php
1.08 KB
lrwxrwxrwx
2024-11-22 17:53:15
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Multilanguage.php
967 B
lrwxrwxrwx
2024-11-22 17:53:15
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Parents.php
15.58 KB
lrwxrwxrwx
2024-11-22 17:53:15
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Simplexlsx.class.php
18.88 KB
lrwxrwxrwx
2024-11-22 17:53:15
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Student.php
18.17 KB
lrwxrwxrwx
2024-11-22 17:53:15
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Teacher.php
32.89 KB
lrwxrwxrwx
2024-11-22 17:53:15
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Updater.php
2.66 KB
lrwxrwxrwx
2024-11-22 17:53:15
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).