Пример #1
0
        $message .= "Your chosen 'permission level' setting is not recognized.<BR>";
    }
    $count = -1;
    $dbStatement = Util::getDbConnection()->prepare("SELECT COUNT( * ) " . "FROM User " . "WHERE LoginName = :newLoginName");
    $dbStatement->bindParam(":newLoginName", $newLoginName, PDO::PARAM_STR);
    $dbStatement->execute();
    $row = $dbStatement->fetch(PDO::FETCH_NUM);
    if (!$row) {
        throw new HardStoryException("Unable to fetch existing login name count row from database.");
    }
    $count = $row[0];
    if ($count != 0) {
        $message .= "The login name you selected is already in use.<BR>";
    }
    if (empty($message)) {
        Util::createUser($newPermissionLevel, $newLoginName, $newPassword1, $newUserName);
        $message = "User Added";
    } else {
        $message = "Problems adding user:<P>" . $message;
    }
}
if ($command == "editUser" || $command == "editUserSave" || $command == "deleteUser") {
    $editedUserID = Util::getIntParam($_POST, "userID");
    if ($editedUserID == 0) {
        if ($command == "deleteUser") {
            $message = "You must select a user to delete.";
        } else {
            $message = "You must select a user to edit.";
        }
        $command = "";
    } else {