예제 #1
0
                $errors[] = "Phone Number is required";
            } else {
                $User_Phone = $_POST['User_Phone'];
            }
            if (!isset($_POST['User_Type'])) {
                $errors[] = "User type is required";
            } else {
                $User_Type = $_POST['User_Type'];
            }
            if (!isset($_POST['User_ID'])) {
                $errors[] = "Please go back and refresh the site!";
            } else {
                $User_ID = $_POST['User_ID'];
            }
            if ($admin_controller->Check_User_Name_For_Edit($User_Name, $User_ID)) {
                admin_redirect_error(Error_Type::SAME_USER_NAME);
            }
            if (empty($errors)) {
                $new_user = new User($User_Name, $User_Password, $User_Type, $User_Phone, $User_ID);
                $edited = $admin_controller->Edit_User($new_user);
                if ($edited) {
                    admin_redirect_success();
                } else {
                    admin_redirect_error(Error_Type::DATA_BASE, $User_ID);
                }
            } else {
                admin_redirect_error(Error_Type::FORM, $User_ID);
            }
        }
    }
}