Example #1
0
}
if (get_class($_SESSION["loggedUser"]) != "Administrator") {
    dieWithError("err-edit-accounts-rights");
}
$val = new Validate();
$edit = new Edit();
$udaje = daj_udaje_uctu($_GET['id']);
$_SESSION['uname'] = $udaje["name"];
$_SESSION['email'] = $udaje["mail"];
$_SESSION['os'] = $udaje["description"];
$_SESSION['liga'] = $udaje["sk_league"];
if (isset($_POST["uname"]) && $val->validate_name($_POST["uname"]) && isset($_POST["email"]) && $val->validate_mail($_POST["email"]) && isset($_POST["os"]) && isset($_POST["liga"])) {
    if ($_SESSION['uname'] != $_POST["uname"]) {
        if ($val->validate_pass($_POST["pass"], $_POST["pass2"])) {
            if ($val->meno($_POST["uname"])) {
                $edit->edituj($_POST["email"], $_POST["pass"], $_POST["uname"], $_POST["os"], $_POST["liga"]);
            }
        }
    } elseif ($_SESSION['email'] != $_POST["email"]) {
        if ($val->validate_pass($_POST["pass"], $_POST["pass2"])) {
            if ($val->email($_POST["email"])) {
                $edit->edituj($_POST["email"], $_POST["pass"], $_POST["uname"], $_POST["os"], $_POST["liga"]);
            }
        }
    } else {
        if ($val->validate_pass($_POST["pass"], $_POST["pass2"])) {
            $edit->edituj($_POST["email"], $_POST["pass"], $_POST["uname"], $_POST["os"], $_POST["liga"]);
        }
    }
}
?>