示例#1
0
function updateAccessUser($auth)
{
    $controller = new ControllerAuthentication();
    if (!$controller->checkUsername($_POST['username'])) {
        $auth->name = trim(strip_tags($_POST['name']));
        $auth->username = trim(strip_tags($_POST['username']));
        $pass = trim(strip_tags($_POST['password']));
        $password_confirm = trim(strip_tags($_POST['password_confirm']));
        $auth->password = md5($pass);
        if (strlen($pass) < 8) {
            echo "<script >alert('Password field must be atleast 8 alphanumeric characters.');</script>";
        } else {
            if ($pass != $password_confirm) {
                echo "<script >alert('Password does not match.');</script>";
            } else {
                $controller->updateAccessUser($auth);
                echo "<script type='text/javascript'>location.href='admin_access.php';</script>";
            }
        }
    } else {
        echo "<script >alert('Username already taken.');</script>";
    }
}
        $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>";
                }
            }
        }
    }
} else {
    echo "<script type='text/javascript'>location.href='403.php';</script>";
}
?>


<!DOCTYPE html>
<html lang="en"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">