public function login_supervisor()
 {
     if (isset($_POST[tpl_supervisor::username() . '_sup']) && isset($_POST[tpl_supervisor::password() . '_sup'])) {
         $username = $_POST[tpl_supervisor::username() . '_sup'];
         $password = $_POST[tpl_supervisor::password() . '_sup'];
         if (!empty($username) && !empty($password)) {
             $db = new data_base(tpl_supervisor::supervisor(), array(tpl_supervisor::id(), tpl_supervisor::name()), array(tpl_supervisor::username() => $username, tpl_supervisor::password() => $this->hash_password($password), tpl_supervisor::active() => 1));
             $data = $db->get_where();
             if (!empty($data)) {
                 $session = new session_supervisor();
                 $session->new_login_supervisors();
                 $session->set_id_user($data[0][tpl_supervisor::id()]);
                 if ($session->get_login_supervisors()) {
                     echo json_encode(array('valid' => true, 'title' => 'Welcome !!', 'massage' => $data[0][tpl_supervisor::name()]));
                 } else {
                     echo json_encode(array('valid' => false, 'title' => 'Oops !!', 'massage' => 'Was not username & password, please try again'));
                 }
             } else {
                 echo json_encode(array('valid' => false, 'title' => 'Oops !!', 'massage' => 'Was not username & password, please try again'));
             }
         } else {
             echo json_encode(array('valid' => false, 'title' => 'Oops !!', 'massage' => 'Was not username & password, please try again'));
         }
     } else {
         echo json_encode(array('valid' => false, 'title' => 'Oops !!', 'massage' => 'Was not username & password, please try again'));
     }
 }
 public function index()
 {
     $lib_supervisor = new session_supervisor();
     if ($lib_supervisor->get_login_supervisors()) {
         $render_site_supervisor = new render_site_supervisor();
         $render_site_supervisor->page_index();
     } else {
         redirect('site');
     }
 }
 public function index()
 {
     $lib_students = new session_students();
     $lib_supervisor = new session_supervisor();
     if ($lib_students->get_login_students()) {
         redirect('students/home_stu');
     } else {
         if ($lib_supervisor->get_login_supervisors()) {
             redirect('supervisor/home_sup');
         } else {
             $template = new render_site();
             $template->page_index();
         }
     }
 }