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 insert() { $name = $_POST[tpl_supervisor::supervisor() . '_' . tpl_supervisor::name()]; $id_college = $_POST[tpl_supervisor::supervisor() . '_' . tpl_supervisor::id_college()]; $id_university = $_POST[tpl_supervisor::supervisor() . '_' . tpl_supervisor::id_university()]; $username = $_POST[tpl_supervisor::supervisor() . '_' . tpl_supervisor::username()]; $password = $_POST[tpl_supervisor::supervisor() . '_' . tpl_supervisor::password()]; $db = new data_base(tpl_supervisor::supervisor(), array(tpl_supervisor::active() => 0, tpl_supervisor::name() => $name, tpl_supervisor::id_college() => $id_college, tpl_supervisor::id_university() => $id_university, tpl_supervisor::username() => $username, tpl_supervisor::password() => $password)); $results = $db->add(); if ($results) { echo json_encode(array('valid' => 1, 'title' => 'Successfully !!', 'massage' => 'I\'ve been Add ' . $name)); } else { echo json_encode(array('valid' => 0, 'title' => 'Oops !!', 'massage' => 'Was not add ' . $name . ', please try again')); } }
" name="<?php echo tpl_supervisor::supervisor() . '_' . tpl_supervisor::password() . '_update_password'; ?> "/> </div> <div class="form-group"> <label for="">Retype New Password <?php echo tpl_supervisor::supervisor(); ?> : </label> <input type="text" class="form-control" id="<?php echo tpl_supervisor::supervisor() . '_' . tpl_supervisor::password() . '_r_update_password'; ?> " name="<?php echo tpl_supervisor::supervisor() . '_' . tpl_supervisor::password() . '_r_update_password'; ?> "/> </div> <button type="submit" class="btn btn-success" id="update" name="update">Save</button> </form> </br> <div class="" id="result_massages_update_password"></div> </div> </div> </div> </div>