<?php require_once 'header.php'; $controller = new ControllerAuthentication(); $extras = new Extras(); $authentication_id = $extras->decryptQuery1(KEY_SALT, $_SERVER['QUERY_STRING']); $user = $controller->getAccessUserByAuthenticationId($authentication_id); if ($authentication_id != null) { if (isset($_POST['submit'])) { $itm = new Authentication(); $itm->authentication_id = $user->authentication_id; $itm->name = trim(strip_tags($_POST['name'])); $itm->username = $user->username; $pass = trim(strip_tags($_POST['password'])); $password_confirm = trim(strip_tags($_POST['password_confirm'])); $password_current = trim(strip_tags($_POST['password_current'])); $itm->password = md5($pass); if (strlen($pass) < 8) { echo "<script >alert('Password field must be atleast 8 alphanumeric characters.');</script>"; } else { if ($user->password != md5($password_current)) { echo "<script >alert('Current password does not match.');</script>"; } else { if ($pass != $password_confirm) { echo "<script >alert('Password does not match.');</script>"; } else { $controller->updateAccessUser($itm); echo "<script type='text/javascript'>location.href='admin_access.php';</script>"; } } }
function getAccessUserByAuthenticationId($authentication_id) { $controller = new ControllerAuthentication(); return $controller->getAccessUserByAuthenticationId($authentication_id); }