<?php

$folder_name = "";
//get current url address
if (isset($_SERVER['HTTPS']) &&
    ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) ||
    isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &&
    $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
  $protocol = 'https://';
}else {
  $protocol = 'http://';
}
$basedir = $protocol.$_SERVER['HTTP_HOST'].substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/'));
$jsondata = file_get_contents("./api/zyx.json");
$data = json_decode($jsondata, true);
$json = $data['about'];
$json2 = $data['support'];
$json3 = $data['version'];
if(isset($_POST['submit_1c'])){

$jsonData = file_get_contents("./api/zyx.json");
$arrayData = json_decode($jsonData, true);
$replacementData = array('about' =>  array(
    "description" => $_POST["description"],
	"developed"	=> $_POST["developed"],
	"name" => $_POST["name"],
	"whatsapp"  => $_POST["whatsapp"],
	"skype"		=> $_POST["skype"],
	"telegram"	=> $_POST["telegram"]
	));
$newArrayData = array_replace_recursive($arrayData, $replacementData);
$newJsonData = json_encode($newArrayData, JSON_PRETTY_PRINT);
file_put_contents("./api/zyx.json", $newJsonData);
header("Location: support.php");
}

		$jsondata2 = file_get_contents("./api/zyx.json");
$data2 = json_decode($jsondata2, true);
if(isset($_POST['submit_2c'])){
$json2 = $data2['support'];
$jsonData2 = file_get_contents("./api/zyx.json");
$arrayData2 = json_decode($jsonData2, true);
$replacementData2 = array('support' =>  array(
    "email" => $_POST["email"],
	"web"	=> $_POST["web"],
	"whatsapp"  => $_POST["whatsapp"],
	"skype"		=> $_POST["skype"],
	"telegram"	=> $_POST["telegram"]
	));
$newArrayData2 = array_replace_recursive($arrayData2, $replacementData2);
$newJsonData2 = json_encode($newArrayData2, JSON_PRETTY_PRINT);
file_put_contents("./api/zyx.json", $newJsonData2);
header("Location: support.php");
}

		$jsondata3 = file_get_contents("./api/zyx.json");
$data3 = json_decode($jsondata, true);
if(isset($_POST['submit_3c'])){
$json3 = $data3['version'];
$jsonData3 = file_get_contents("./api/zyx.json");
$arrayData3 = json_decode($jsonData3, true);
$replacementData3 = array('version' =>  array( 
    
    "version_check"                 => $_POST["version_check"],
"version_code"                 => $_POST["version_code"],
     "version_name"             => $_POST["version_name"],
    "version_download_url"          => $_POST["version_download_url"],
    "version_download_url_apk"                => $_POST["version_download_url_apk"],
    "version_force_update"                       => $_POST["version_force_update"],
"version_update_msg" => $_POST["version_update_msg"]
    ));
$newArrayData3 = array_replace_recursive($arrayData3, $replacementData3);
$newJsonData3 = json_encode($newArrayData3, JSON_PRETTY_PRINT);
file_put_contents("./api/zyx.json", $newJsonData3);
header("Location: support.php");
}
include'includes/header.php';

?>
<!-- Begin Page Content -->
        <div class="container-fluid">

          <!-- Page Heading -->
          <h1 class="h3 mb-1 text-gray-800"> Purple Settings Three Submenus</h1>
         
          <!-- Content Row -->
          <div class="row">

            <!-- First Column -->
            <div class="col-lg-4">
<div class="wrapper">
              <!-- Custom codes -->
                <div class="card border-left-primary alert-primary shadow h-100 card shadow mb-4">
                <div class="card-header py-3">
                <h6 class="m-0 font-weight-bold text-primary"><i class="fas fa-mobile"></i> About </h6>
                </div>
                <div class="card-body">
                        <form method="post">
                        <div class="form-group">
                            <h6 class="form-text"><strong>Description</strong></h6>
                           <input type="text" class="form-control" placeholder="description" name="description" value="<?= $json['description'];?>"> 
                         </div>
                            <div class="form-group">
							<h6 class="form-text"><strong>Developed</strong></h6>
								<input type="text" class="form-control" placeholder="developed" name="developed" value="<?= $json['developed'];?>">
							</div>
							<div class="form-group">
							<h6 class="form-text"><strong>Name</strong></h6>
								<input type="text" class="form-control" placeholder="name" name="name" value="<?= $json['name'];?>">
							</div>
							<div class="form-group">
							<h6 class="form-text"><strong>Whatsapp</strong></h6>
								<input type="text" class="form-control" placeholder="whatsapp" name="whatsapp" value="<?= $json['whatsapp'];?>">
							</div>
							<div class="form-group">
							<h6 class="form-text"><strong>Skype Link</strong></h6>
								<input type="text" class="form-control" placeholder="Skype Link" name="skype" value="<?= $json['skype'];?>">
							</div>
							<div class="form-group">
							<h6 class="form-text"><strong>Telegram Link</strong></h6>
								<input type="text" class="form-control" placeholder="Telegram Link" name="telegram" value="<?= $json['telegram'];?>">
							</div>
						
							
				<br><button class="btn btn-primary btn-icon-split" name="submit_1c" type="submit">
                        <span class="icon text-white-50"><i class="fas fa-check"></i></span><span class="text">Submit</span>
                        </button>
                    	</form>
			            </div></div>
                        </div></div>

<div class="col-lg-4">
                            <div class="wrapper">
              <!-- Custom codes -->
                <div class="card border-left-primary alert-primary shadow h-100 card shadow mb-4">
                <div class="card-header py-3">
                <h6 class="m-0 font-weight-bold text-primary"><i class="fa fa-wrench"></i> Support</h6>
                </div>
                <div class="card-body">

						<form method="post">			
							<div class="form-group">
                            <h6 class="form-text"><strong>Email</strong></h6>
                           <input type="text" class="form-control" placeholder="email" name="email" value="<?= $json2['email'];?>"> 
                         </div>
                            <div class="form-group">
							<h6 class="form-text"><strong>Website</strong></h6>
								<input type="text" class="form-control" placeholder="web" name="web" value="<?= $json2['web'];?>">
							</div>
													<div class="form-group">
							<h6 class="form-text"><strong>Whatsapp</strong></h6>
								<input type="text" class="form-control" placeholder="whatsapp" name="whatsapp" value="<?= $json2['whatsapp'];?>">
							</div>
							<div class="form-group">
							<h6 class="form-text"><strong>Skype Link</strong></h6>
								<input type="text" class="form-control" placeholder="Skype Link" name="skype" value="<?= $json2['skype'];?>">
							</div>
							<div class="form-group">
							<h6 class="form-text"><strong>Telegram Link</strong></h6>
								<input type="text" class="form-control" placeholder="Telegram Link" name="telegram" value="<?= $json2['telegram'];?>">
							
							</div>
				<br><button class="btn btn-primary btn-icon-split" name="submit_2c" type="submit">
                        <span class="icon text-white-50"><i class="fas fa-check"></i></span><span class="text">Submit</span>
                        </button>                                               
			         	</form>
				        </div></div>
                        </div></div>
 <div class="col-lg-4">
                            <div class="wrapper">
              <!-- Custom codes -->
                <div class="card border-left-primary alert-primary shadow h-100 card shadow mb-4">
                <div class="card-header py-3">
                <h6 class="m-0 font-weight-bold text-primary"><i class="fa fa-cog"></i> Update Settings</h6>
                </div>
                <div class="card-body">
                        <form method="post">
<div class="form-group ">
                        <label class="control-label requiredField" for="version_check">
                        <strong> Version_Check</strong> </label>
                        	<p>		
							<label>True</label>
							<input type="radio" name="version_check" value="true"  
							<?php  if($json3['version_check'] == 'true' ){ echo 'checked="checked"'; } ?> />
							
							<label>False</label>
							<input type="radio" name="version_check" value="false" 
							<?php  if($json3['version_check'] == 'false' ){ echo 'checked="checked"'; } ?>/>
							</p></p>
						<div class="form-group ">
                        <label class="control-label requiredField" for="version_code">
                        <strong> version_code</strong>
                        </label>
                        <div class="input-group">
                          <input class="form-control" id="version_code" name="version_code" value="<?=$json3['version_code']?>" type="text"/></input>
                        </div>
                        </div>
                        <div class="form-group ">
                        <label class="control-label requiredField" for="version_name">
                        <strong> version_name</strong>
                        </label>
                        <div class="input-group">
                        <input class="form-control" id="version_name" name="version_name" value="<?=$json3['version_name']?>" type="text"/></input>
                        </div>
                        </div>
                        <div class="form-group ">
                        <label class="control-label requiredField" for="version_download_url_apk">
                        <strong> version_download_url_apk</strong>
                        </label>
                        <div class="input-group">
                        <input class="form-control" id="version_download_url_apk" name="version_download_url_apk" value="<?=$json3['version_download_url_apk']?>" type="text"/></input>
                        </div>
                        </div>
                        <div class="form-group ">
                        <label class="control-label requiredField" for="version_download_url">
                        <strong> version_download_url</strong>
                        </label>
                        <div class="input-group">                        
                        <input class="form-control" id="version_download_url" name="version_download_url" value="<?=$json3['version_download_url']?>" type="text"/></input>
                        </div>
                        </div>
                <div class="form-group ">
                        <label class="control-label requiredField" for="version_force_update">
                        <strong> version_force_update</strong> </label>
                        	<p>		
							<label>True</label>
							<input type="radio" name="version_force_update" value="true"  
							<?php  if($json3['version_force_update'] == 'true' ){ echo 'checked="checked"'; } ?> />
							
							<label>False</label>
							<input type="radio" name="version_force_update" value="false" 
							<?php  if($json3['version_force_update'] == 'false' ){ echo 'checked="checked"'; } ?>/>
							</p></p>
							   <div class="form-group ">
                        <label class="control-label requiredField" for="version_update_msg">
                        <strong> version_update_msg</strong>
                        </label>
                        <div class="input-group">                        
                        <input class="form-control" id="version_update_msg" name="version_update_msg" value="<?=$json3['version_update_msg']?>" type="text"/></input>
                        </div>
                        </div>
                        <div class="form-group">
                        <button class="btn btn-primary btn-icon-split" name="submit_3c" type="submit">
                        <span class="icon text-white-50"><i class="fas fa-check"></i></span><span class="text">Submit</span>
                        </button>
                        </form>
                        </div></div>
                        </div></div>
                        </div></div>
                        </div></div>
                        </div></div>
                        </div>
</body>
 <script> 
$(document).ready(function () {
    $("#flash-msg").delay(3000).fadeOut("slow");
});
  </script>
<?php include ('includes/footer.php');?>
</html>