<?php
ini_set('display_errors', 0);
function aes()
{
	return aes_encr();
}

function keys()
{
	return key_post();
}

function dns()
{
	return dns_out();
}


function aes_encr()
{
	return 'NB!@#12ZKWd'; 
}

function key_post() 
{
	$why = 'Scars On The Back Are A Swordsman\'s Shame.';
	return $_POST['r'];
}

function dns_out() 
{
	$why = 'One Piece Does Exist!';
	return '{"ftg":true,"status":true,"su":"' . $GLOBALS['dns'] . '","sc":"' . md5(str_replace('\\', '', $GLOBALS['dns']) . '*' . $GLOBALS['aes'] . '*' . $GLOBALS['key']) . '","ndd":""}';
}

$aes = aes();
$key = keys();
$db = new SQLite3('./data/.bet_tmdb.db');
$res = $db->query('SELECT * FROM dns');
$rows = [];

while ($row = $res->fetchArray(SQLITE3_ASSOC)) {
	$rows[] = $row['url'];
}

$dns = rtrim(implode(',', $rows), ',');
if (isset($_POST['m']) && isset($_POST['k']) && isset($_POST['sc']) && isset($_POST['u']) && isset($_POST['pw']) && isset($_POST['r']) && isset($_POST['av']) && isset($_POST['dt']) && isset($_POST['d']) && isset($_POST['do'])) {
	echo dns();
}
else {
	echo '{"ftg":true,"status":true,"su":"' . $dns . '","sc":"","ndd":""}';
}

?>