<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$currFolder = dirname($_SERVER["PHP_SELF"]);
$lurl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http') . ':\/\/' . $_SERVER['HTTP_HOST'] . addcslashes($currFolder, '/');
$output='Ian'; $db = new SQLite3('./.db.db');

$res = $db->query("SELECT * FROM control WHERE id='1'");
$row = $res->fetchArray();
//$status = $row['status'];
$backgroundColor = $row['backgroundColor'];
$version = $row['version'];
$apk = $row['apk'];
$host = $row['host'];
$hosts_url = $row['hosts_url'];
$hosts_name = $row['hosts_name'];
$hosts2_url = $row['hosts2_url'];
$hosts2_name = $row['hosts2_name'];
$hosts3_url = $row['hosts3_url'];
$hosts3_name = $row['hosts3_name'];
$hosts4_url = $row['hosts4_url'];
$hosts4_name = $row['hosts4_name'];
$hosts5_url = $row['hosts5_url'];
$hosts5_name = $row['hosts5_name'];
$output ='{"status": "active", "backgroundColor": "'.$backgroundColor.'", "version": "'.$version.'", "apk": "'.$apk.'", "apps": [], "host": "'.$host.'", "host_urls": [{"name":"'.$hosts_name.'", "url":"'.$hosts_url.'"}';

if (!empty($hosts2_url))
	$output.=',{"name":"'.$hosts2_name.'", "url":"'.$hosts2_url.'"}';

if (!empty($hosts3_url))
	$output.=',{"name":"'.$hosts3_name.'", "url":"'.$hosts3_url.'"}';

if (!empty($hosts4_url))
	$output.=',{"name":"'.$hosts4_name.'", "url":"'.$hosts4_url.'"}';

if (!empty($hosts5_url))
	$output.=',{"name":"'.$hosts5_name.'", "url":"'.$hosts5_url.'"}';

$output.='], "rss": "'.$lurl.'\/rss.php", "addons": "'.$lurl.'\/addons.php", "storeConfig": "'.$lurl.'\/store.php", "icons": ';

$res = $db->query("SELECT * FROM laf WHERE id='1'");
$row = $res->fetchArray();
$live = $row['live'];
$logo = $row['logo'];
$banner = $row['banner'];
$banner2 = $row['banner2'];
$banner3 = $row['banner3'];
$banner4 = $row['banner4'];
$banner5 = $row['banner5'];
$catchup = $row['catchup'];
$movie = $row['movie'];
$series = $row['series'];
$settings = $row['settings'];
$background = $row['background'];
$netflix = $row['netflix'];
$youtube = $row['youtube'];
$playstore = $row['playstore'];
$settings2 = $row['settings2'];
$appdrawer = $row['appdrawer'];
$output.='{"live": "'.$live.'", "logo": "'.$logo.'" ,"banner": "'.$banner.'" ,"banner_url": "" ,"banner2": "'.$banner2.'" ,"banner_url2": "" ,"banner3": "'.$banner3.'" ,"banner_url3": "" ,"banner4": "'.$banner4.'" ,"banner_url4": "" ,"banner5": "'.$banner5.'" ,"banner_url5": "" ,"catchup": "'.$catchup.'" ,"movie": "'.$movie.'" ,"series": "'.$series.'" ,"settings": "'.$settings.'" ,"background": "'.$background.'" ,"netflix": "'.$netflix.'" ,"youtube": "'.$youtube.'" ,"playstore": "'.$playstore.'" ,"settings2": "'.$settings2.'" ,"appdrawer": "'.$appdrawer.'"}}';
echo $output;
?>