Example #1
0
							</form>
							<?php 
                    }
                } elseif ($_GET['do'] == "edit-client") {
                    $websiteProperty = new WebsiteProperty();
                    echo '<p>On this page you can edit clients.</p>';
                    if (!empty($_GET['invert']) && is_numeric($_GET['invert'])) {
                        $status = $client->getFieldDataByID($_GET['invert'], "valid");
                        if ($status !== false) {
                            if ($status == "True") {
                                $status = "False";
                            } else {
                                $status = "True";
                            }
                        }
                        if ($client->updateFieldByID($_GET['invert'], "valid", $status)) {
                            echo '<p class="notification green">You have successfully inverted the status of a client.</p>';
                            $log->addLog($_SESSION['loggedIn']['id'], "Updated a client status.");
                        } else {
                            echo '<p class="notification red">Something went wrong while updating the status of the client.</p>';
                        }
                    } elseif (!empty($_GET['edit']) && is_numeric($_GET['edit'])) {
                        $showTable = true;
                        if ($client->checkValueExists("id", $_GET['edit'])) {
                            $showTable = false;
                            if ($_SERVER['REQUEST_METHOD'] == "POST") {
                                if (empty($_POST['client_firstname']) || empty($_POST['client_nickname']) || empty($_POST['client_valid'])) {
                                    echo '<p class="notification red">All fields are required.</p>';
                                } else {
                                    if (strlen($_POST['client_nickname']) > 32) {
                                        echo '<p class="notification red">The client username cannot contain more than 32 characters!</p>';