<?php 
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$jsondata = file_get_contents("./api/zyx.json");
$data = json_decode($jsondata, true);
$json = $data['private_menu'];
if(isset($_POST['submit'])){
$message = '<div class="alert alert-primary" id="flash-msg"><h4><i class="icon fa fa-check"></i>Items Updated!</h4></div>';
$json = $data['private_menu'];
$jsonData = file_get_contents("./api/zyx.json");
$arrayData = json_decode($jsonData, true);

$newData['private_menu'] = array('private_menu' =>  array(
"addtion_app_name"             => $_POST["addtion_app_name"],
    "addtion_app_pkg"               => $_POST["addtion_app_pkg"],
    "addtion_app_icon"           => $_POST["addtion_app_icon"],
    "addtion_app_url"                 => $_POST["addtion_app_url"],
    "addtion_app_status"    => $_POST["addtion_app_status"]
    ));
     if(isset($newdata)){
     $newdata = json_encode($newdata);};
     if(isset($key)){
     $index = array_search( $key, $keys, $strict = true );};
   $newdata = array_merge_recursive($arrayData, $newData);
  //$newArrayData = array_merge_recursive($arrayData, $json);
  $newdata['private_menu'] = array_values($newdata['private_menu']);  
$newJsonData = json_encode($newdata, JSON_PRETTY_PRINT);
file_put_contents("./api/zyx.json", $newJsonData);
header("Location: appstore.php");
		}
include ('includes/header.php');


echo "            <div class=\"col-md-8 px-4\">\n";
echo "              <div class=\"card bg text-primay alert-primary\">\n";
echo "                <div class=\"card-header card-header-warning\">\n";
echo "                  <h4 class=\"card-title\">Add App</h4>\n";
echo "                </div>\n";
echo "                <div class=\"card-body\">\n";
echo "                  <form  method=\"post\">\n";
echo "                      <div>\n";
echo "                        <div class=\"form-group\">\n";
echo "                          <label class=\"bmd-label-floating\">addtion_app_name</label>\n";
echo "                          <input type=\"text\" class=\"form-control\" name=\"addtion_app_name\">\n";
echo "                        </div>\n";
echo "                      </div>\n";
echo "                      <div>\n";
echo "                        <div class=\"form-group\">\n";
echo "                          <label class=\"bmd-label-floating\">addtion_app_pkg</label>\n";
echo "                          <input type=\"text\" class=\"form-control\" name=\"addtion_app_pkg\">\n";
echo "                        </div>\n";
echo "                      </div>\n";
echo "                      <div>\n";
echo "                        <div class=\"form-group\">\n";
echo "                          <label class=\"bmd-label-floating\">addtion_app_icon</label>\n";
echo "                          <input type=\"text\" class=\"form-control\" name=\"addtion_app_icon\">\n";
echo "                        </div>\n";
echo "                      </div>\n";
echo "                      <div>\n";
echo "                        <div class=\"form-group\">\n";
echo "                          <label class=\"bmd-label-floating\">addtion_app_url</label>\n";
echo "                          <input type=\"text\" class=\"form-control\" name=\"addtion_app_url\">\n";
echo "                        </div>\n";
echo "                      </div>\n";
echo "                      <div>\n";
echo "                        <div class=\"form-group\">\n";
echo "                          <label class=\"bmd-label-floating\">addtion_app_status</label>\n";
echo "                          <input type=\"text\" class=\"form-control\" name=\"addtion_app_status\">\n";
echo "                        </div>\n";
echo "                      </div>\n";
echo "                      <div>\n";
echo "					<br><button type=\"submit\" name=\"submit\" class=\"btn btn-primary pull-right\">Submit</button>\n";
echo "				</form>\n";
echo "				</div>\n";
echo "              </div>\n";
echo "            </div>\n";
echo "		   </div>\n";
echo "    <br><br><br>\n";
include ('includes/footer.php');
echo "</body>\n";
echo "\n";
echo "</html>\n";
?>