public function login_student() { if (isset($_POST['username_stu']) && isset($_POST[tpl_students::password() . '_stu'])) { $username = $_POST[tpl_students::username() . '_stu']; $password = $_POST[tpl_students::password() . '_stu']; if (!empty($username) && !empty($password)) { $db = new data_base(tpl_students::students(), array(tpl_students::id(), tpl_students::first_name()), array(tpl_students::username() => $username, tpl_students::password() => $this->hash_password($password), tpl_students::status() => 1)); $data = $db->get_where(); if (!empty($data)) { $session = new session_students(); $session->new_login_students(); $session->set_id_user($data[0][tpl_students::id()]); if ($session->get_login_students()) { echo json_encode(array('valid' => true, 'title' => 'Welcome !!', 'massage' => $data[0][tpl_students::first_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')); } }
" name="<?php echo tpl_students::students() . '_' . tpl_students::last_name(); ?> "/> </div> <div class="form-group"> <label for=""> Username : </label> <input type="text" class="form-control" id="<?php echo tpl_students::students() . '_' . tpl_students::username(); ?> " name="<?php echo tpl_students::students() . '_' . tpl_students::username(); ?> "/> </div> <div class="form-group"> <label for=""> Email : </label> <input type="text" class="form-control" id="<?php echo tpl_students::students() . '_' . tpl_students::email(); ?> " name="<?php echo tpl_students::students() . '_' . tpl_students::email(); ?> "/>