<?php
//session_start();
;
//$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['app_conf'];
$json2 = $data['ads'];
$json3 = $data['api_key'];
$json4 = $data['app_conf'];
if (isset($_POST['submit_1c']))
{
    $jsonData = file_get_contents("./api/zyx.json");
    $arrayData = json_decode($jsonData, true);
    $replacementData = array(
        'app_conf' => array(
            "cloud_remind_me" => $_POST["cloud_remind_me"],
            "cloud_recording" => $_POST["cloud_recording"],
            "cloud_recent_fav" => $_POST["cloud_recent_fav"],
            "cloud_remind_me_url" => $_POST["cloud_remind_me_url"],
        )
    );
    $newArrayData = array_replace_recursive($arrayData, $replacementData);
    $newJsonData = json_encode($newArrayData, JSON_PRETTY_PRINT);
    file_put_contents("./api/zyx.json", $newJsonData);
    header("Location: purple2.php?");
}
if (isset($_POST['submit_2c']))
{
    $json2 = $data['ads'];
    $jsonData2 = file_get_contents("./api/zyx.json");
    $arrayData2 = json_decode($jsonData2, true);
    $replacementData2 = array(
        'ads' => array(
            "ads_app_id" => $_POST["ads_app_id"],
            "ads_banner" => $_POST["ads_banner"],
            "ads_intrestial" => $_POST["ads_intrestial"],
            "ads_rewarded" => $_POST["ads_rewarded"],
            "ads_native" => $_POST["ads_native"],
            "ads_intrestial_time_delay" => $_POST["ads_intrestial_time_delay"],
            "ads_ios_status" => $_POST["ads_ios_status"],
            "ads_status" => $_POST["ads_status"],
        )
    );
    $newArrayData2 = array_replace_recursive($arrayData2, $replacementData2);
    $newJsonData2 = json_encode($newArrayData2, JSON_PRETTY_PRINT);
    file_put_contents("./api/zyx.json", $newJsonData2);
    header("Location: purple2.php?");
}
if (isset($_POST['submit_3c']))
{
    $json3 = $data['api_key'];
    $jsonData3 = file_get_contents("./api/zyx.json");
    $arrayData3 = json_decode($jsonData3, true);
    $replacementData3 = array(
        'api_key' => array(
            "imdb_api" => $_POST["imdb_api"],
            "g_api_key" => $_POST["g_api_key"],
            "image_imdb" => $_POST["image_imdb"],
            "trakt_api_key" => $_POST["trakt_api_key"],
            "ip_stack_key" => $_POST["ip_stack_key"],
            "check_ip" => $_POST["check_ip"],
        )
    );
    $newArrayData3 = array_replace_recursive($arrayData3, $replacementData3);
    $newJsonData3 = json_encode($newArrayData3, JSON_PRETTY_PRINT);
    file_put_contents("./api/zyx.json", $newJsonData3);
    header("Location: purple2.php?");
}
if(isset($_POST['submit_4c'])){
$json4 = $data['app_conf'];
$jsonData4 = file_get_contents("./api/zyx.json");
$arrayData4 = json_decode($jsonData4, true);
$replacementData4 = array('app_conf' =>  array(
	"multi_profile_auto_login"=>$_POST["multi_profile_auto_login"],
	"multi_profile"=>$_POST["multi_profile"],
	"sub_profile"=>$_POST["sub_profile"],
    "sub_user_profile"=>$_POST["sub_user_profile"],
	"sub_user_profile_allow"=>$_POST["sub_user_profile_allow"], 
	"sub_user_profile_default"=>$_POST["sub_user_profile_default"], 
	"sub_user_profile_setting"=>$_POST["sub_user_profile_setting"], 
	"sub_user_profile_select_on_start"=>$_POST["sub_user_profile_select_on_start"],
	));
$newArrayData4 = array_replace_recursive($arrayData4, $replacementData4);
$newJsonData4 = json_encode($newArrayData4, JSON_PRETTY_PRINT);
file_put_contents("./api/zyx.json", $newJsonData4);
header("Location: purple2.php?");
}


include ('includes/header.php');
?>

    
<!-- Begin Page Content -->
        <div class="container-fluid">
          <!-- Page Heading -->
          <h1 class="h3 mb-1 text-gray-800"> Purple Settings   Four Submenus</h1>
          <!-- Content Row -->
          <div class="row">
            <!--first-->
<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> Cloud Settings </h6>
                </div>
                <div class="card-body">
                <form method="post">
<div class="form-group ">
         <h6 class="form-text"><strong>cloud_remind_me</strong></h6>
                        <input class="form-control" id="cloud_remind_me" name="cloud_remind_me"  placeholder="" value="<?=$json['cloud_remind_me'] ?>" type="text"/>
                        </div>
							<div class="form-group">
                        
                              </div>
    <div class="form-group ">
                        <label class="control-label requiredField" for="cloud_recording">
                        <strong>cloud_recording =
<? echo $json['cloud_recording']; ?></strong> </label>
                        	<p>
							<label>True</label>
							<input type="radio" name="cloud_recording" value="true"  
							 
							<? if ($json['cloud_recording'] == 'true')
{
    echo 'checked="checked"';
} ?> />
							<label>False</label>
							<input type="radio" name="cloud_recording" value="false" 
							
							<? if ($json['cloud_recording'] == 'false')
{
    echo 'checked="checked"';
} ?>/>
							</p>
							</div>
    <div class="form-group ">
                        <label class="control-label requiredField" for="cloud_recent_fav">
                        <strong>cloud_recent_fav =
<? echo $json['cloud_recent_fav']; ?></strong> </label>
                        	<p>
							<label>True</label>
							<input type="radio" name="cloud_recent_fav" value="true"  
							 
							<? if ($json['cloud_recent_fav'] == 'true')
{
    echo 'checked="checked"';
} ?> />
							<label>False</label>
							<input type="radio" name="cloud_recent_fav" value="false" 
							
							<? if ($json['cloud_recent_fav'] == 'false')
{
    echo 'checked="checked"';
} ?>/>
							</p>
							</div>
    <div class="form-group ">
         <h6 class="form-text"><strong>cloud_remind_me_url</strong></h6>
                        <input class="form-control" id="cloud_remind_me_url" name="cloud_remind_me_url"  placeholder="" value="<?=$json['cloud_remind_me_url'] ?>" type="text"/>
                        </div>
							<div class="form-group">
                        <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>
                              </div>
                                 </div>
                                   </form>
                                     </div>
                                       </div>
                                         </div>
         <!--Second 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="fa fa-wrench"></i> In App Ads</h6>
                </div>
                	 <div class="card-body">
                        <form method="post">
                            <div class="form-group ">
       <label class="control-label " for="ads_app_id"><strong>ads_app_id</strong></label>
               <div class="input-group">
                        <input class="form-control" name="ads_app_id"  id="ads_app_id"  placeholder="" value="<?php echo $json2["ads_app_id"] ?>"  type="text" /></div></div>
   <div class="form-group ">
       <label class="control-label " for="ads_banner"><strong>ads_banner</strong></label>
               <div class="input-group">
                        <input class="form-control" name="ads_banner"  id="ads_banner"  placeholder="" value="<?php echo $json2["ads_banner"] ?>"  type="text" /></div></div>

<div class="form-group ">
       <label class="control-label " for="ads_intrestial"><strong>ads_intrestial</strong></label>
               <div class="input-group">
                        <input class="form-control" name="ads_intrestial"  id="stream_format"  placeholder="" value="<?php echo $json2["ads_intrestial"] ?>"  type="text" /></div></div>

<div class="form-group ">
       <label class="control-label " for="ads_rewarded"><strong>ads_rewarded</strong></label>
               <div class="input-group">
                        <input class="form-control" name="ads_rewarded"  id="ads_rewarded"  placeholder="" value="<?php echo $json2["ads_rewarded"] ?>"  type="text" /></div></div>
<div class="form-group ">
       <label class="control-label " for="ads_native"><strong>ads_native</strong></label>
               <div class="input-group">
                        <input class="form-control" name="ads_native"  id="ads_native"  placeholder="" value="<?php echo $json2["ads_native"] ?>"  type="text" /></div></div>

<div class="form-group ">
       <label class="control-label " for="stream_ads_intrestial_time_delayformat"><strong>ads_intrestial_time_delay</strong></label>
               <div class="input-group">
                        <input class="form-control" name="ads_intrestial_time_delay"  id="ads_intrestial_time_delay"  placeholder="" value="<?php echo $json2["ads_intrestial_time_delay"] ?>"  type="text" /></div></div>

<div class="form-group ">
                        <label class="control-label requiredField" for="ads_ios_status">
                        <strong>ads_ios_status =<? echo $json2['ads_ios_status'] ?></strong> </label>
                        		<p><label>True</label>
							<input type="radio" name="ads_ios_status" value="true"  							 
							 <? if ($json2['ads_ios_status'] == 'true')
{
    echo 'checked="checked"';
} ?> />							
							<label>False</label>
							<input type="radio" name="ads_ios_status" value="false" 
							<? if ($json2['ads_ios_status'] == 'false')
{
    echo 'checked="checked"';
} ?>	/>
							</label></div>
							<div class="form-group ">
                        <label class="control-label requiredField" for="ads_status">
                        <strong>ads_status =<? echo $json2['ads_status'] ?></strong> </label>
                        		<p><label>True</label>
							<input type="radio" name="ads_status" value="true"  							 
							 <? if ($json2['ads_status'] == 'true')
{
    echo 'checked="checked"';
} ?> />							
							<label>False</label>
							<input type="radio" name="ads_status" value="false" 
							<? if ($json2['ads_status'] == 'false')
{
    echo 'checked="checked"';
} ?>	/>
							</label></div>
    
	<div class="form-group ">
                        <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">Submit2</span>
                           </button>
                              </div>
                                 </div>
                                    </form>
                                       </div>
                                          </div>
                                             </div>
        <!-- Third 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="fa fa-cog"></i> Api Settings </h6>
                </div>
                <div class="card-body">
                <form method="post">
              

                            <div class="form-group ">
       <label class="control-label " for="imdb_api"><strong>imdb_api</strong></label>
               <div class="input-group">
                        <input class="form-control" name="imdb_api"  id="imdb_api"  placeholder="" value="<?php echo $json3["imdb_api"] ?>"  type="text" /></div></div>
   <div class="form-group ">
       <label class="control-label " for="g_api_key"><strong>g_api_key</strong></label>
               <div class="input-group">
                        <input class="form-control" name="g_api_key"  id="ads_app_id"  placeholder="" value="<?php echo $json3["g_api_key"] ?>"  type="text" /></div></div>

<div class="form-group ">
       <label class="control-label " for="image_imdb"><strong>image_imdb</strong></label>
               <div class="input-group">
                        <input class="form-control" name="image_imdb"  id="image_imdb"  placeholder="" value="<?php echo $json3["image_imdb"] ?>"  type="text" /></div></div>

<div class="form-group ">
       <label class="control-label " for="trakt_api_key"><strong>trakt_api_key</strong></label>
               <div class="input-group">
                        <input class="form-control" name="trakt_api_key"  id="trakt_api_key"  placeholder="" value="<?php echo $json3["trakt_api_key"] ?>"  type="text" /></div></div>
<div class="form-group ">
       <label class="control-label " for="ip_stack_key"><strong>ip_stack_key</strong></label>
               <div class="input-group">
                        <input class="form-control" name="ip_stack_key"  id="ip_stack_key"  placeholder="" value="<?php echo $json3["ip_stack_key"] ?>"  type="text" /></div></div>

<div class="form-group ">
       <label class="control-label " for="check_ip"><strong>check_ip</strong></label>
               <div class="input-group">
                        <input class="form-control" name="check_ip"  id="check_ip"  placeholder="" value="<?php echo $json3["check_ip"] ?>"  type="text" /></div></div>
              

                          <br><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></a>;
				           </form>
			                  </div>
                                 </button>
                                   </div></div>
                                      </div></div>
<!-- Content Row -->
          
            <!--fourth-->
<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> Cloud Settings </h6>
                </div>
                <div class="card-body">
                <form method="post">
                     	
	 	
	<div class="form-group ">
                        <label class="control-label requiredField" for="multi_profile_auto_login">
                        <strong> multi_profile_auto_login = <? echo $json4["multi_profile_auto_login"]?>
                              </strong>
                        </label><p>		
							<label>True
							<input type="radio" name="multi_profile_auto_login" value="true" 
							<? if($json4["multi_profile_auto_login"] == 'true' ){ echo 'checked="checked"'; } ?> />
							</label>
							<label>False
							<input type="radio" name="multi_profile_auto_login" value="false"  
						<?	if($json4["multi_profile_auto_login"] == 'false' ){ echo 'checked="checked"'; } ?> />
							</label></div></p>
    						 	
	<div class="form-group ">
                        <label class="control-label requiredField" for="multi_profile">
                        <strong> multi_profile = <? echo $json4["multi_profile"]?>
                              </strong>
                        </label><p>		
							<label>True
							<input type="radio" name="multi_profile" value="true"  
							<?if($json4["multi_profile"] == 'true' ){ echo 'checked="checked"'; } ?> />
							</label>
							<label>False
							<input type="radio" name="multi_profile" value="false"  
							<?if($json4["multi_profile"] == 'false' ){ echo 'checked="checked"'; } ?> />
							</label></div></p>
    						 	
	<div class="form-group ">
                        <label class="control-label requiredField" for="sub_profile">
                        <strong> sub_profile = <? echo $json4["sub_profile"]?>
                              </strong>
                        </label><p>		
							<label>True
							<input type="radio" name="sub_profile" value="true" 
							<?if($json4["sub_profile"] == 'true' ){ echo 'checked="checked"'; } ?> />
							</label>
							<label>False
							<input type="radio" name="sub_profile" value="false"  
							<?if($json4["sub_profile"] == 'false' ){ echo 'checked="checked"'; } ?> />
							</label></div></p>
    						 	
	<div class="form-group ">
                        <label class="control-label requiredField" for="sub_user_profile">
                        <strong> sub_user_profile = 
                              </strong>
                        </label><p>		
							<label>True
							<input type="radio" name="sub_user_profile" value="true" 
							<?if($json4["sub_user_profile"] == 'true' ){ echo 'checked="checked"'; } ?> />
							</label>
							<label>False
							<input type="radio" name="sub_user_profile" value="false" 
							<?if($json4["sub_user_profile"] == 'false' ){ echo 'checked="checked"'; } ?> />
							</label></div></p>
    						 	
	<div class="form-group ">
       <label class="control-label " for="sub_user_profile_allow"><strong>sub_user_profile_allow</strong></label>
               <div class="input-group">
                        <input class="form-control" name="sub_user_profile_allow"  id="sub_user_profile_allow"  placeholder="" value="<? echo $json4["sub_user_profile_allow"]?>"  type="text" /></div></div>
    						 	
	<div class="form-group ">
                        <label class="control-label requiredField" for="sub_user_profile_default">
                        <strong> sub_user_profile_default = <? echo $json4["sub_user_profile_default"]?>
                              </strong>
                        </label><p>		
							<label>True
							<input type="radio" name="sub_user_profile_default" value="true"   
						<?	if($json4["sub_user_profile_default"] == 'true' ){ echo 'checked="checked"'; } ?> />
							</label>
							<label>False
							<input type="radio" name="sub_user_profile_default" value="false"  
							<?if($json4["sub_user_profile_default"] == 'false' ){ echo 'checked="checked"'; } ?> />
							</label></div></p>
    						 	
	<div class="form-group ">
                        <label class="control-label requiredField" for="sub_user_profile_setting">
                        <strong> sub_user_profile_setting = <? echo $json4["sub_user_profile_setting"]?>
                              </strong>
                        </label><p>		
							<label>True
							<input type="radio" name="sub_user_profile_setting" value="true" 
							<?if($json4["sub_user_profile_setting"] == 'true' ){ echo 'checked="checked"'; } ?> />
							</label>
							<label>False
							<input type="radio" name="sub_user_profile_setting" value="false" 
							<?if($json4["sub_user_profile_setting"] == 'false' ){ echo 'checked="checked"'; } ?> />
							</label></div></p>
    						 	
	<div class="form-group ">
                        <label class="control-label requiredField" for="sub_user_profile_select_on_start">
                        <strong> sub_user_profile_select_on_start = <? echo $json4["sub_user_profile_select_on_start"]?>/>
                              </strong>
                        </label><p>		
							<label>True
							<input type="radio" name="sub_user_profile_select_on_start" value="true" 
							<?if($json4["sub_user_profile_select_on_start"] == 'true' ){ echo 'checked="checked"'; } ?> />
							</label>
							<label>False
							<input type="radio" name="sub_user_profile_select_on_start" value="false" 
							<?if($json4["sub_user_profile_select_on_start"] == 'false' ){ echo 'checked="checked"'; } ?> />
							</label></div></p>
    						
    						
<br><button class="btn btn-primary btn-icon-split" name="submit_4c" type="submit">;
                        <span class="icon text-white-50\"><i class=\"fas fa-check"></i></span><span class="text">Submit</span></a>;
				           </form>
			                  </div>
                                 </button>
                                   </div></div>
                                      </div></div>
                                         </div></div> 
                                            </div>
 <script> 
$(document).ready(function () {
    $("#flash-msg").delay(3000).fadeOut("slow");
});
  </script>
<? include ('includes/footer.php'); ?>
</html>
