<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
session_start();
include_once ($_SERVER['DOCUMENT_ROOT'] . '/_config/functions.php');
spl_autoload_register('my_autoload');
$area                               = 1;
include($_SERVER['DOCUMENT_ROOT'] . HOME_DIR . '/Auth/chk.auth.php');


$headline                           = '<h2>Kunden bearbeiten</h2>';
$site                               = $_SERVER["HTTP_REFERER"];
$sitePrevious                       = $_SERVER["HTTP_REFERER"];

$client                             = new client();

if($_SERVER["REQUEST_METHOD"]       == "POST") {
  
  $client->saveUpdateClientData($_POST);
  echo '<meta http-equiv="refresh" content="0; URL=' . $_POST['site'] . '">';

} else {
  $dropdownZugehoerigkeit           = $client->getDropdownZugehoerigkeit();
  $row                              = $client->getClientDataByUuid($_GET['id']);
  include ($_SERVER['DOCUMENT_ROOT'] . HOME_DIR . TEMPLATE_DIR . '/clients/edit.php');
}

