

<?php

session_start();
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$ifofuser = $_SESSION['id'];

if (!$ifofuser) {
	header('Location: logout.php');
}

$jsondata = file_get_contents('./includes/eggzie.json');
$data = json_decode($jsondata, true);
$json = $data['colours'];
$colour_2 = $json['bb'];
$colour_3 = $json['cc'];
$colour_4 = $json['dd'];
$colour_5 = $json['ee'];
$colour_6 = $json['ff'];
$colour_7 = $json['gg'];
$colour_8 = $json['hh'];
$colour_9 = $json['ii'];
$colour_10 = $json['jj'];
$colour_11 = $json['kk'];
$colour_12 = $json['ll'];
$colour_13 = $json['mm'];
$colour_14 = $json['nn'];
$colour_15 = $json['oo'];
$colour_16 = $json['pp'];
$colour_17 = $json['qq'];
$colour_18 = $json['rr'];
$colour_19 = $json['ss'];
$colour_20 = $json['tt'];
$colour_21 = $json['uu'];
$json_allow = $data['info'];
$allow_colours = $json_allow['a5'];

if ($ifofuser == '1') {
	if ($allow_colours != '1') {
		header('Location: dashboard.php');
	}
}

if (isset($_POST['submit'])) {
	$jsonData = file_get_contents('./includes/eggzie.json');
	$date = date('D d-m-Y H:i:s');
	$arrayData = json_decode($jsonData, true);
	$replacementData = [
		'colours' => ['aa' => $date, 'bb' => $_POST['bb'], 'cc' => $_POST['cc'], 'dd' => $_POST['dd'], 'ee' => $_POST['ee'], 'ff' => $_POST['ff'], 'gg' => $_POST['gg'], 'hh' => $_POST['hh'], 'ii' => $_POST['ii'], 'jj' => $_POST['jj'], 'kk' => $_POST['kk'], 'll' => $_POST['ll'], 'mm' => $_POST['mm'], 'nn' => $_POST['nn'], 'oo' => $_POST['oo'], 'pp' => $_POST['pp'], 'qq' => $_POST['qq'], 'rr' => $_POST['rr'], 'ss' => $_POST['ss'], 'tt' => $_POST['tt'], 'uu' => $_POST['uu']]
	];
	$newArrayData = array_replace_recursive($arrayData, $replacementData);
	$newJsonData = json_encode($newArrayData, JSON_UNESCAPED_UNICODE);
	file_put_contents('./includes/eggzie.json', $newJsonData);
	header('Location: colours.php?success');
}

include 'includes/header.php';
echo ' <!-- Begin Page Content -->' . "\n";
echo '        <div class="container-fluid">' . "\n";
echo "\n";

if (isset($_GET['success'])) {
	echo $msg_colour;
}



echo ' <style>
    
.card {
    text-align: left;
    border-radius: 26px;
    border-color: #9c9c9c;
    background-color: #252b3b;
    !important: ;
}
    
</style>' . "\n";


echo '          <!-- Page Heading -->' . "\n";
echo '         ' . "\n";
echo '              <!-- Custom codes -->' . "\n";
echo '                <div class="card border-left-primary shadow h-100 card shadow mb-4">' . "\n";
echo '                <div class="card-header py-3">' . "\n";
echo '                <h6 class="m-0 font-weight-bold" style="color:' . $colour_11 . ';"><i class="fa fa-paint-brush"></i> Colours</h6>' . "\n";
echo '                </div>' . "\n";
echo '                <div class="card-body">' . "\n";
echo '                            <form method="post">' . "\n";
echo '                                <div class="form-group in-line">' . "\n";
echo '                                    <label class="control-label " style="color:' . $colour_head_18 . ';" for="oo">' . "\n";
echo '                                        <input value="' . $colour_15 . '" name="oo" type="color">' . "\n";
echo '                                        <strong>Login Bg </strong>' . "\n";
echo '                                    </label>' . "\n";
echo '                                    <label class="control-label float-right" style="color:' . $colour_head_18 . ';" for="ee">' . "\n";
echo '                                        <strong>Main Bg </strong>' . "\n";
echo '                                        <input value="' . $colour_5 . '" name="ee" type="color">' . "\n";
echo '                                    </label>' . "\n";
echo '                                </div>' . "\n";
echo '                                <div class="form-group in-line">' . "\n";
echo '                                    <label class="control-label " style="color:' . $colour_head_18 . ';" for="nn">' . "\n";
echo '                                        <input value="' . $colour_14 . '" name="nn" type="color">' . "\n";
echo '                                        <strong>Header Title</strong>' . "\n";
echo '                                    </label>' . "\n";
echo '                                    <label class="control-label float-right" style="color:' . $colour_head_18 . ';" for="dd">' . "\n";
echo '                                        <strong>Border</strong>' . "\n";
echo '                                        <input value="' . $colour_4 . '" name="dd" type="color">' . "\n";
echo '                                    </label>' . "\n";
echo '                                </div>' . "\n";
echo '                                <div class="form-group in-line">' . "\n";
echo '                                    <label class="control-label" style="color:' . $colour_head_18 . ';" for="pp">' . "\n";
echo '                                        <input value="' . $colour_16 . '" name="pp" type="color">' . "\n";
echo '                                        <strong>Page Title </strong>' . "\n";
echo '                                    </label>' . "\n";
echo '                                    <label class="control-label float-right" style="color:' . $colour_head_18 . ';" for="ff">' . "\n";
echo '                                        <strong>SideBar Bg </strong>' . "\n";
echo '                                        <input value="' . $colour_6 . '" name="ff" type="color">' . "\n";
echo '                                    </label>' . "\n";
echo '                                </div>' . "\n";
echo '                                <div class="form-group in-line">' . "\n";
echo '                                    <label class="control-label " style="color:' . $colour_head_18 . ';" for="mm">' . "\n";
echo '                                        <input value="' . $colour_13 . '" name="mm" type="color">' . "\n";
echo '                                        <strong>SideBar Icons </strong>' . "\n";
echo '                                    </label>' . "\n";
echo '                                    <label class="control-label float-right" style="color:' . $colour_head_18 . ';" for="gg">' . "\n";
echo '                                        <strong>SideBar Text </strong>' . "\n";
echo '                                        <input value="' . $colour_7 . '" name="gg" type="color">' . "\n";
echo '                                    </label>' . "\n";
echo '                                </div>' . "\n";
echo '                                <div class="form-group in-line">' . "\n";
echo '                                    <label class="control-label " style="color:' . $colour_head_18 . ';" for="hh">' . "\n";
echo '                                        <input value="' . $colour_8 . '" name="hh" type="color">' . "\n";
echo '                                        <strong>Card Header </strong>' . "\n";
echo '                                    </label>' . "\n";
echo '                                    <label class="control-label float-right" style="color:' . $colour_head_18 . ';" for="kk">' . "\n";
echo '                                        <strong>Card Title Text</strong>' . "\n";
echo '                                        <input value="' . $colour_11 . '" name="kk" type="color">' . "\n";
echo '                                    </label>' . "\n";
echo '                                </div>' . "\n";
echo '                                <div class="form-group in-line">' . "\n";
echo '                                    <label class="control-label " style="color:' . $colour_head_18 . ';" for="ii">' . "\n";
echo '                                        <input value="' . $colour_9 . '" name="ii" type="color">' . "\n";
echo '                                        <strong>Card Bg </strong>' . "\n";
echo '                                    </label>' . "\n";
echo '                                    <label class="control-label float-right" style="color:' . $colour_head_18 . ';" for="jj">' . "\n";
echo '                                        <strong>Main Text </strong>' . "\n";
echo '                                        <input value="' . $colour_10 . '" name="jj" type="color">' . "\n";
echo '                                    </label>' . "\n";
echo '                                </div>' . "\n";
echo '                                <div class="form-group in-line">' . "\n";
echo '                                    <label class="control-label " style="color:' . $colour_head_18 . ';" for="qq">' . "\n";
echo '                                        <input value="' . $colour_17 . '" name="qq" type="color">' . "\n";
echo '                                        <strong>Input Bg </strong>' . "\n";
echo '                                    </label>' . "\n";
echo '                                    <label class="control-label float-right" style="color:' . $colour_head_18 . ';" for="rr">' . "\n";
echo '                                        <strong>Main Labels </strong>' . "\n";
echo '                                        <input value="' . $colour_18 . '" name="rr" type="color">' . "\n";
echo '                                    </label>' . "\n";
echo '                                </div>' . "\n";
echo '                                <div class="form-group in-line">' . "\n";
echo '                                    <label class="control-label " style="color:' . $colour_head_18 . ';" for="bb">' . "\n";
echo '                                        <input value="' . $colour_2 . '" name="bb" type="color">' . "\n";
echo '                                        <strong>Table Text </strong>' . "\n";
echo '                                    </label>' . "\n";
echo '                                    <label class="control-label float-right" style="color:' . $colour_head_18 . ';" for="cc">' . "\n";
echo '                                        <strong>Table Bg </strong>' . "\n";
echo '                                        <input value="' . $colour_3 . '" name="cc" type="color">' . "\n";
echo '                                    </label>' . "\n";
echo '                                </div>' . "\n";
echo '                                <div class="form-group in-line">' . "\n";
echo '                                    <label class="control-label" style="color:' . $colour_head_18 . ';" for="ll">' . "\n";
echo '                                        <input value="' . $colour_12 . '" name="ll" type="color">' . "\n";
echo '                                        <strong>Table Labels </strong>' . "\n";
echo '                                    </label>' . "\n";
echo '                                    <label class="control-label float-right" style="color:' . $colour_head_18 . ';" for="ss">' . "\n";
echo '                                        <strong>Submit Buttons </strong>' . "\n";
echo '                                        <input value="' . $colour_19 . '" name="ss" type="color">' . "\n";
echo '                                    </label>' . "\n";
echo '                                </div>' . "\n";
echo '                                <div class="form-group in-line">' . "\n";
echo '                                    <label class="control-label" style="color:' . $colour_head_18 . ';" for="tt">' . "\n";
echo '                                        <input value="' . $colour_20 . '" name="tt" type="color">' . "\n";
echo '                                        <strong>Switch On </strong>' . "\n";
echo '                                    </label>' . "\n";
echo '                                    <label class="control-label float-right" style="color:' . $colour_head_18 . ';" for="uu">' . "\n";
echo '                                        <strong>Switch Off </strong>' . "\n";
echo '                                        <input value="' . $colour_21 . '" name="uu" type="color">' . "\n";
echo '                                    </label>' . "\n";
echo '                                </div>' . "\n";
echo '                        <button class="btn btn-success btn-icon-split" style="background-color:' . $colour_head_btn . ';border-color:' . $colour_head_btn . ';color:' . $colour_head_10 . ';" name="submit" type="submit">' . "\n";
echo '                        <span class="icon text-white-50"><i class="fas fa-check" style="color:' . $colour_head_10 . ';"></i></span><span class="text">Submit</span>' . "\n";
echo '                        </button>' . "\n";
echo '              </div>' . "\n";
echo '            </div>' . "\n";
echo '            </div>' . "\n";
include 'includes/footer.php';
require 'includes/egz.php';
echo '</body>' . "\n";



?>
