<?php

function sanitize($data)
{
	return $data;
}

function real_ip()
{
	$ip = 'undefined';

	if (isset($_SERVER)) {
		$ip = $_SERVER['REMOTE_ADDR'];

		if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
			$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
		}
		else if (isset($_SERVER['HTTP_CLIENT_IP'])) {
			$ip = $_SERVER['HTTP_CLIENT_IP'];
		}
	}
	else {
		$ip = getenv('REMOTE_ADDR');

		if (getenv('HTTP_X_FORWARDED_FOR')) {
			$ip = getenv('HTTP_X_FORWARDED_FOR');
		}
		else if (getenv('HTTP_CLIENT_IP')) {
			$ip = getenv('HTTP_CLIENT_IP');
		}
	}

	$ip = htmlspecialchars($ip, ENT_QUOTES, 'UTF-8');
	return $ip;
}

header('Cache-Control: no-cache, no-store, must-revalidate');
header('Pragma: no-cache');
header('Expires: 0');
ini_set('display_errors', 0);
ini_set('display_startup_errors', 0);
error_reporting(E_ALL);
date_default_timezone_set('Europe/London');
$PING = date('d-m-Y H:i:s');
$jsondata = file_get_contents('./json/slc_xcdata.json');
$data = json_decode($jsondata, true);
$json = $data['app'];
$security_key = $json['security_key'];
$security_id = $json['security_id'];
$widget = $json['widget'];

if (isset($_GET['tag'])) {
	$Tag = $_GET['tag'];
}

if (isset($_GET['userid'])) {
	$UserID = $_GET['userid'];
}

if (isset($_GET['cid'])) {
	$cid = $_GET['cid'];
}

if (isset($_GET['aid'])) {
	$aid = $_GET['aid'];
}

if (isset($_GET['l'])) {
	$lic = $_GET['l'];
}

if (isset($_GET['b'])) {
	$bb = $_GET['b'];
}

if (isset($_GET['a'])) {
	$app = $_GET['a'];
}

if (isset($_GET['appid'])) {
	$appid = $_GET['appid'];
}

if (isset($_GET['version'])) {
	$version = $_GET['version'];
}

if (isset($_GET['device_type'])) {
	$device = $_GET['device_type'];
}

if (isset($_GET['p'])) {
	$p = $_GET['p'];
}

if (isset($_GET['an'])) {
	$a_name = $_GET['an'];
}

if (isset($_GET['customerid'])) {
	$customer = $_GET['customerid'];
}

if (isset($_GET['online'])) {
	$online = $_GET['online'];
}

if (isset($_GET['did'])) {
	$did = $_GET['did'];
}

if (isset($_GET['tag'])) {
	$LASTTIME = date('d-m-Y H:i:s');
	$Tag = $_GET['tag'];
	if (($Tag == 'slclicV3') || ($Tag == 'licv3') || ($Tag == 'licV3')) {
		$key = base64_decode(base64_decode($security_key));
		$ivd = base64_decode(base64_decode($security_id));
		echo bin2hex(openssl_encrypt(file_get_contents('./json/slc_xcdata.json'), 'AES-128-CBC', $key, OPENSSL_RAW_DATA, $ivd));
	}
	if (($Tag == 'msg_cat_view') || ($Tag == 'msg')) {
		$jsondataa = file_get_contents('./json/slc_ann.json');
		$jsona = json_decode($jsondataa, true);
		$announcement = $jsona['announcement'];
		$ann_channel = $jsona['channel'];
		$ann_expire = $jsona['ann_expire'];
		$ann_interval = $jsona['ann_interval'];
		$ann_disappear = $jsona['ann_disappear'];
		$ann_status = $jsona['ann_status'];
		$msg_success = $jsona['success'];
		$msg_message = $jsona['message'];
		$msg_status = $jsona['msg_status'];
		$msg_expire = $jsona['msg_expire'];
		$db = new SQLite3('./db/slc_message.db');
		$res = $db->query('SELECT * ' . "\r\n\t\t\t\t\t\t" . 'FROM messages ' . "\r\n\t\t\t\t\t\t" . 'WHERE userid=\'' . $UserID . '\'');

		while ($row = $res->fetchArray()) {
			$message = $row['message'];
			$userid = $row['userid'];
			$status = $row['status'];
			$expire = $row['expire'];
			$msgid = $row['id'];
		}

		if (empty($message)) {
			if ($ann_status == 'INACTIVE') {
				echo '{"tag":"connv2","success":"0","api_ver":"1.0v","message":"","msgid": "0","msg_status":"INACTIVE","msg_expire": "2021-01-30 05:00:00","announcement": "","ann_status": "INACTIVE","ann_expire": "2021-01-30 05:00:00","ann_interval": "","ann_disappear": "","channel":""}';
			}
			else {
				echo '{"tag":"connv2","success":"1","api_ver":"1.0v","message":"","msgid": "0","msg_status":"INACTIVE","msg_expire": "2021-01-30 05:00:00","announcement": "' . $announcement . '","ann_status": "ACTIVE","ann_expire": "' . $ann_expire . '","ann_interval": "' . $ann_interval . '","ann_disappear": "' . $ann_disappear . '","channel":"' . $ann_channel . '"}';
			}
		}
		else if ($ann_status == 'INACTIVE') {
			echo '{"tag":"connv2","success":"0","api_ver":"1.0v","message":"' . $message . '","msgid": "' . $msgid . '","msg_status":"' . $status . '","msg_expire":"' . $expire . '","announcement": "","ann_status": "INACTIVE","ann_expire": "2021-01-30 05:00:00","ann_interval": "","ann_disappear": "","channel":""}';
		}
		else {
			echo '{"tag":"connv2","success": "1","api_ver":"1.0v","message":"' . $message . '","msgid": "' . $msgid . '","msg_status":"' . $status . '","msg_expire":"' . $expire . '","announcement":"' . $announcement . '","ann_status":"ACTIVE","ann_expire":"' . $ann_expire . '","ann_interval":"' . $ann_interval . '","ann_disappear":"' . $ann_disappear . '","channel":"' . $ann_channel . '"}';
		}
	}
	if (isset($_GET['online']) || isset($_GET['appid'])) {
		$LASTTIME = date('d-m-Y H:i:s');
		$TIME = date('d-m-Y H:i:s');
		$IPADDRESS = real_ip();

		if (isset($_GET['userid'])) {
			$UserID = $_GET['userid'];
		}
		else {
			$UserID = '';
		}

		$db1 = new SQLite3('./db/slc_users_online.db');
		$db1->exec('CREATE TABLE IF NOT EXISTS logging(id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, appid TEXT, version TEXT, device TEXT, pkg TEXT, app TEXT, cid TEXT, uid TEXT, status TEXT, d TEXT, time TEXT, last_online TEXT, ping TEXT, ip TEXT)');
		$res1 = $db1->query('SELECT * FROM logging WHERE uid=\'' . $UserID . '\'');

		while ($row5 = $res1->fetchArray()) {
			$app_id = $row5['appid'];
		}

		if (empty($app_id)) {
			$db1->exec('INSERT INTO logging(appid, version, device, pkg, app, cid, uid, status, d, time, ping, ip) ' . "\r\n\t\t\t\t\t\t" . 'VALUES( \'' . $_GET['appid'] . '\',' . "\r\n\t\t\t\t\t\t\t\t" . '\'' . $_GET['version'] . '\',' . "\r\n\t\t\t\t\t\t\t\t" . '\'' . $_GET['device_type'] . '\',' . "\r\n\t\t\t\t\t\t\t\t" . '\'' . $_GET['p'] . '\',' . "\r\n\t\t\t\t\t\t\t\t" . '\'' . $_GET['an'] . '\',' . "\r\n\t\t\t\t\t\t\t\t" . '\'' . $_GET['customerid'] . '\',' . "\r\n\t\t\t\t\t\t\t\t" . '\'' . $_GET['userid'] . '\',' . "\r\n\t\t\t\t\t\t\t\t" . '\'' . $_GET['online'] . '\',' . "\r\n\t\t\t\t\t\t\t\t" . '\'' . $_GET['did'] . '\',' . "\r\n\t\t\t\t\t\t\t\t" . '\'' . $TIME . '\',' . "\r\n\t\t\t\t\t\t\t\t" . '\'' . $PING . '\',' . "\r\n\t\t\t\t\t\t\t\t" . '\'' . $IPADDRESS . '\'' . "\r\n\t\t\t\t\t\t\t\t" . ')');
		}
		else if ($_GET['online'] == 'yes') {
			$db1->exec('UPDATE logging SET  appid=\'' . $_GET['appid'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'version=\'' . $_GET['version'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'device=\'' . $_GET['device_type'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'pkg=\'' . $_GET['p'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'app=\'' . $_GET['an'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'cid=\'' . $_GET['customerid'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'status=\'' . $_GET['online'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'd=\'' . $_GET['did'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'last_online=\'' . $LASTTIME . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'ping=\'' . $PING . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'ip=\'' . $IPADDRESS . '\'' . "\r\n\t\t\t\t\t\t\t\t\t\t" . 'WHERE uid=\'' . $_GET['userid'] . '\'' . "\r\n\t\t\t\t\t\t\t\t\t\t");
		}
		else {
			$db1->exec('UPDATE logging SET  appid=\'' . $_GET['appid'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'version=\'' . $_GET['version'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'device=\'' . $_GET['device_type'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'pkg=\'' . $_GET['p'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'app=\'' . $_GET['an'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'cid=\'' . $_GET['customerid'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'status=\'' . $_GET['online'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'd=\'' . $_GET['did'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'ping=\'' . $PING . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'ip=\'' . $IPADDRESS . '\'' . "\r\n\t\t\t\t\t\t\t\t\t\t" . 'WHERE uid=\'' . $_GET['userid'] . '\'' . "\r\n\t\t\t\t\t\t\t\t\t\t");
		}
	}

	if ($Tag == 'connv2') {
		$LASTTIME = date('d-m-Y H:i:s');
		$TIME = date('d-m-Y H:i:s');
		$IPADDRESS = real_ip();

		if (isset($_GET['userid'])) {
			$UserID = $_GET['userid'];
		}
		else {
			$UserID = '';
		}

		$db1 = new SQLite3('./db/slc_users_online.db');
		$db1->exec('CREATE TABLE IF NOT EXISTS logging(id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, appid TEXT, version TEXT, device TEXT, pkg TEXT, app TEXT, cid TEXT, uid TEXT, status TEXT, d TEXT, time TEXT, last_online TEXT, ping TEXT, ip TEXT)');
		$T1 = strtotime($dbt1) < time();

		while ($row5 = $res1->fetchArray()) {
			$app_id = $row5['appid'];
		}

		if (empty($app_id)) {
			$db1->exec('INSERT INTO logging(appid, version, device, pkg, app, cid, uid, status, d, time, ping, ip) ' . "\r\n\t\t\t\t\t\t" . 'VALUES( \'' . $_GET['appid'] . '\',' . "\r\n\t\t\t\t\t\t\t\t" . '\'' . $_GET['version'] . '\',' . "\r\n\t\t\t\t\t\t\t\t" . '\'' . $_GET['device_type'] . '\',' . "\r\n\t\t\t\t\t\t\t\t" . '\'' . $_GET['p'] . '\',' . "\r\n\t\t\t\t\t\t\t\t" . '\'' . $_GET['an'] . '\',' . "\r\n\t\t\t\t\t\t\t\t" . '\'' . $_GET['customerid'] . '\',' . "\r\n\t\t\t\t\t\t\t\t" . '\'' . $_GET['userid'] . '\',' . "\r\n\t\t\t\t\t\t\t\t" . '\'' . $_GET['online'] . '\',' . "\r\n\t\t\t\t\t\t\t\t" . '\'' . $_GET['did'] . '\',' . "\r\n\t\t\t\t\t\t\t\t" . '\'' . $TIME . '\',' . "\r\n\t\t\t\t\t\t\t\t" . '\'' . $PING . '\',' . "\r\n\t\t\t\t\t\t\t\t" . '\'' . $IPADDRESS . '\'' . "\r\n\t\t\t\t\t\t\t\t" . ')');
		}
		else if ($_GET['online'] == 'yes') {
			$db1->exec('UPDATE logging SET  appid=\'' . $_GET['appid'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'version=\'' . $_GET['version'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'device=\'' . $_GET['device_type'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'pkg=\'' . $_GET['p'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'app=\'' . $_GET['an'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'cid=\'' . $_GET['customerid'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'status=\'' . $_GET['online'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'd=\'' . $_GET['did'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'last_online=\'' . $LASTTIME . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'ping=\'' . $PING . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'ip=\'' . $IPADDRESS . '\'' . "\r\n\t\t\t\t\t\t\t\t\t\t" . 'WHERE uid=\'' . $_GET['userid'] . '\'' . "\r\n\t\t\t\t\t\t\t\t\t\t");
		}
		else {
			$db1->exec('UPDATE logging SET  appid=\'' . $_GET['appid'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'version=\'' . $_GET['version'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'device=\'' . $_GET['device_type'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'pkg=\'' . $_GET['p'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'app=\'' . $_GET['an'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'cid=\'' . $_GET['customerid'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'status=\'' . $_GET['online'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'd=\'' . $_GET['did'] . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'ping=\'' . $PING . '\',' . "\r\n\t\t\t\t\t\t\t\t\t\t\t" . 'ip=\'' . $IPADDRESS . '\'' . "\r\n\t\t\t\t\t\t\t\t\t\t" . 'WHERE uid=\'' . $_GET['userid'] . '\'' . "\r\n\t\t\t\t\t\t\t\t\t\t");
		}

		$jsondataa = file_get_contents('./json/slc_ann.json');
		$jsona = json_decode($jsondataa, true);
		$announcement = $jsona['announcement'];
		$ann_channel = $jsona['channel'];
		$ann_expire = $jsona['ann_expire'];
		$ann_interval = $jsona['ann_interval'];
		$ann_disappear = $jsona['ann_disappear'];
		$ann_status = $jsona['ann_status'];
		$msg_success = $jsona['success'];
		$msg_message = $jsona['message'];
		$msg_status = $jsona['msg_status'];
		$msg_expire = $jsona['msg_expire'];
		$db = new SQLite3('./db/slc_message.db');
		$stmt = $db->prepare('SELECT * FROM messages WHERE userid=?');
		$stmt->bindValue(1, sanitize($UserID));
		$res = $stmt->execute();
		$row = $res->fetchArray();
		$msgid = $row['id'];
		$message = $row['message'];
		$userid = $row['userid'];
		$status = $row['status'];
		$expire = $row['expire'];

		if (empty($message)) {
			if ($ann_status == 'INACTIVE') {
				echo '{"tag":"connv2","success":"0","api_ver":"1.0v","message":"","msgid": "0","msg_status":"INACTIVE","msg_expire": "2021-01-30 05:00:00","announcement": "","ann_status": "INACTIVE","ann_expire": "2021-01-30 05:00:00","ann_interval": "","ann_disappear": "","channel":""}';
			}
			else {
				echo '{"tag":"connv2","success":"1","api_ver":"1.0v","message":"","msgid": "0","msg_status":"INACTIVE","msg_expire": "2021-01-30 05:00:00","announcement": "' . $announcement . '","ann_status": "ACTIVE","ann_expire": "' . $ann_expire . '","ann_interval": "' . $ann_interval . '","ann_disappear": "' . $ann_disappear . '","channel":"' . $ann_channel . '"}';
			}
		}
		else if ($ann_status == 'INACTIVE') {
			echo '{"tag":"connv2","success":"0","api_ver":"1.0v","message":"' . $message . '","msgid": "' . $msgid . '","msg_status":"' . $status . '","msg_expire":"' . $expire . '","announcement": "","ann_status": "INACTIVE","ann_expire": "2021-01-30 05:00:00","ann_interval": "","ann_disappear": "","channel":""}';
		}
		else {
			echo '{"tag":"connv2","success": "1","api_ver":"1.0v","message":"' . $message . '","msgid": "' . $msgid . '","msg_status":"' . $status . '","msg_expire":"' . $expire . '","announcement":"' . $announcement . '","ann_status":"ACTIVE","ann_expire":"' . $ann_expire . '","ann_interval":"' . $ann_interval . '","ann_disappear":"' . $ann_disappear . '","channel":"' . $ann_channel . '"}';
		}
	}

	if ($Tag == 'whatsup') {
		echo '{' . "\r\n\t\t\t" . '"tag":"whatsup",' . "\r\n\t\t\t" . '"success":"0",' . "\r\n\t\t\t" . '"api_ver":"1.0v",' . "\r\n\t\t\t" . '"whatsup":"no"' . "\r\n\t\t" . '}';
	}

	if ($Tag == 'gfilter_n') {
		echo '{"tag":"gfilter_n","success":"0","api_ver":"1.0v","status":"No","filter":[]}';
	}

	if ($Tag == 'vpnconfigV2') {
		$output = '{"tag":"vpnconfigV2","success":"1","api_ver":"1.0v","vpnconfigs":[';
		$db = new SQLite3('./db/slc_vpn.db');
		$res = $db->query('SELECT * FROM vpn');

		while ($row = $res->fetchArray()) {
			$id = $row['id'];
			$userid = $row['userid'];
			$vpn_appid = $row['vpn_appid'];
			$vpn_country = $row['vpn_country'];
			$vpn_state = $row['vpn_state'];
			$vpn_config = $row['vpn_config'];
			$vpn_status = $row['vpn_status'];
			$auth_type = $row['auth_type'];
			$auth_embedded = $row['auth_embedded'];
			$username = $row['username'];
			$password = $row['password'];
			$vdate = $row['vdate'];

			if (!empty($vpn_config)) {
				$output .= '{"id":"' . $id . '","userid":"' . $cid . '","vpn_appid":"' . $aid . '","vpn_country":"' . $vpn_country . '","vpn_state":"' . $vpn_state . '","vpn_config":"' . $vpn_config . '","vpn_status":"' . $vpn_status . '","auth_type":"' . $auth_type . '","auth_embedded":"' . $auth_embedded . '","username":"' . $username . '","password":"' . $password . '","date":"' . $vdate . '"},';
			}
		}

		$x = substr($output, -1);

		if ($x == ',') {
			$output = substr_replace($output, '', -1);
		}

		$output .= ']}';
		$key = base64_decode(base64_decode($security_key));
		$ivd = base64_decode(base64_decode($security_id));
		echo bin2hex(openssl_encrypt($output, 'AES-128-CBC', $key, OPENSSL_RAW_DATA, $ivd));
	}

	if ($Tag == 'checkupdate') {
		$jsondata1 = file_get_contents('./json/slc_xcdata.json');
		$data1 = json_decode($jsondata1, true);
		$json1 = $data1['app'];
		$apkurl1 = $json1['apkurl'];
		$version_code1 = $json1['version_code'];
		echo '{"tag":"checkupdate","success":"1","api_ver":"1.0v","version_code":"' . $version_code1 . '","apkurl":"' . $apkurl1 . '"}';
	}

	if ($Tag == 'intro') {
		$db = new SQLite3('./db/slc_intro.db');
		$res = $db->query('SELECT * FROM slcintro');
		$rowU = $res->fetchArray();
		$new_url = str_replace(' ', '', $rowU['url']);
		$intro_on_off = $rowU['intro_on_off'];

		if ($intro_on_off == 'yes') {
			$intro = $new_url;
		}
		else {
			$real_file_location_path_or_url = '/intro/nointro.mp4';
			$intro = (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] !== 'off') ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF'], 2) . $real_file_location_path_or_url;
		}

		header('Location: ' . $intro . '?' . time());
		exit();
	}

	function getRandomImage($dir_path = NULL)
	{
		if (!empty($dir_path)) {
			$files = scandir($dir_path);
			$count = count($files);

			if (2 < $count) {
				$index = rand(2, $count - 1);
				$filename = $files[$index];
				return '<img src="' . $dir_path . '/' . $filename . '" alt="' . $filename . '">';
			}
			else {
				return 'The directory is empty!';
			}
		}
		else {
			return 'Please enter valid path to image directory!';
		}
	}

	if ($Tag == 'introplay') {
		echo '{"intro":"no"}';
	}

	if ($Tag == 'banner') {
		$bg_color = 'transparent';
		echo ' ' . "\r\n\t" . '<!DOCTYPE html>' . "\r\n" . '<html lang="en">' . "\r\n" . '<head>' . "\r\n" . '  <title>slc Dashboard Widget</title>' . "\r\n" . '  <meta charset="utf-8">' . "\r\n" . '  <meta name="viewport" content="width=device-width, initial-scale=1">' . "\r\n" . '  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">' . "\r\n" . '  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>' . "\r\n" . '  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>' . "\r\n" . '  <style>' . "\r\n\r\n" . 'body {' . "\r\n" . '       // background-image: url(\'\');' . "\r\n" . '    height: 100vh;' . "\r\n" . '  margin: 0;' . "\r\n" . '    padding: 0;' . "\r\n" . '    border: 0;' . "\r\n" . '     overflow:hidden;' . "\r\n" . '    color: white;' . "\r\n" . '    background-color: transparent;' . "\r\n" . '  background-size: 100% 100%;' . "\r\n" . '  background-attachment: fixed;' . "\r\n" . '  background-position: center;' . "\r\n" . '  ' . "\r\n" . '  background-repeat: no-repeat;}' . "\r\n" . '  ' . "\r\n\r\n" . '.container {' . "\r\n" . '  overflow: hidden;' . "\r\n" . '  margin: 0;' . "\r\n" . '    padding: 0;' . "\r\n" . '    border: 0;' . "\r\n" . 'width: 100%;' . "\r\n" . '  height: 100%;' . "\r\n" . '  }' . "\r\n" . '  ' . "\r\n" . '  .video-container {' . "\r\n\r\n" . '  //border: solid green;' . "\r\n\r\n" . '  position: fixed;' . "\r\n" . '  ' . "\r\n" . '  width: 100%;' . "\r\n" . '  height: 90%;' . "\r\n" . '  z-index: -1;' . "\r\n" . '  overflow: hidden;' . "\r\n" . '  position: relative;' . "\r\n" . '}' . "\r\n\r\n" . '.video-container video {' . "\r\n" . '  min-width: 100%;' . "\r\n" . '  min-height: 100%;' . "\r\n" . '  position: absolute;' . "\r\n" . '  top: 50%;' . "\r\n" . '  left: 50%;' . "\r\n" . '  transform: translateX(-50%) translateY(-50%);' . "\r\n" . '}' . "\r\n\r\n" . '/* Just styling the content of the div, the *magic* in the previous rules */' . "\r\n" . '.video-container .caption {' . "\r\n" . '  z-index: 1;' . "\r\n" . '  position: relative;' . "\r\n" . '  text-align: center;' . "\r\n" . '  color: #dc0000;' . "\r\n" . '  padding: 10px;' . "\r\n" . '}' . "\r\n\r\n" . '  ' . "\r\n" . '  </style>' . "\r\n" . '  ' . "\r\n" . '</head>' . "\r\n" . '<body bgcolor="' . $bg_color . '">';
		$dbslca = new SQLite3('./db/slc_ads.db');
		$dbslca->exec('CREATE TABLE IF NOT EXISTS slcads(id INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL,' . "\r\n" . 'title VARCHAR(100), ' . "\r\n" . '    type VARCHAR(100), ' . "\r\n" . '    link VARCHAR(100), ' . "\r\n" . '    description VARCHAR(100), ' . "\r\n" . '    position VARCHAR(100), ' . "\r\n" . '    extension VARCHAR(100), ' . "\r\n" . '    createdon VARCHAR(100), ' . "\r\n" . '    thumbpath VARCHAR(100)' . "\r\n" . ')');
		$resads = $dbslca->query('SELECT * FROM slcads');
		include './widgets/widget' . $widget . '.php';
		echo "\r\n" . '</body>' . "\r\n" . '</html>' . "\r\n";
	}
	if (($_GET['tag'] == 'webs') || ($_GET['tag'] == 'webspt') || ($_GET['tag'] == 'sports')) {
		include './packs/sports.php';
	}

	if ($Tag == 'imgs') {
		include './packs/images.php';
	}
}
else {
	header('Location: index.php');
}

?>