private function create_student($row) { $obj = new student(); $obj->setstudentId($row["student_Id"]); $obj->setFirstName($row["FirstName"]); $obj->setLastName($row["LastName"]); $obj->setDob(new \DateTime($row["dob"])); $obj->setGender($row["gender"]); $obj->setUsername($row["UserName"]); $obj->setPassword($row["password"]); $obj->setapproved($row["approved"]); return $obj; }
protected function savepass() { $required = array("current" => "Current Password", "new" => "New Password"); foreach ($required as $key => $value) { if (!isset($_POST[$key]) || $_POST[$key] == '' || $_POST[$key] == 'select') { echo $value . ' is Required<br/>'; return; } } global $user; global $objPDO; $student = new student($objPDO, $user->getuserId()); if (md5($_POST['current']) == $student->getPassword()) { $student->setPassword(md5($_POST['new'])); $student->save(); } else { echo 'The Current Password is Wrong'; return; } echo '<meta http-equiv="Refresh" content="0;url=http://localhost/cloud/profile"/>'; }