Вход Регистрация
Файл: controllers/blocker.php
Строк: 43
<?php

//     Типы действий:
//     1 - проверить статус;
//     2 - заблокировать;
//     3 - разблокировать
// вернуть -1 - ошибка чтения файла - допилить

session_start();

if (!isset(
$_SESSION['auth'])) 
{
    die(
"0");
}

if(isset(
$_GET["do"])) $do addslashes(htmlspecialchars(strip_tags(trim($_GET["do"])))); else die("0");

include(
"../config.php");

function 
checkState() {

    
$f fopen("../../.htaccess""r");

    if(!
$f)
    {
      return 
"-1";
    }
    else
    {
        while(!
feof($f)) 
        { 
            
$text $text.fgets($f);
        }
    }

    
fclose($f);

    if(
stripos($text"santi-block"))
    {
        return 
"true";
    }
    else
    {
        return 
"false";
    }
}

function 
block() {

    
$f fopen("../../.htaccess""a");

    
fwrite($f"# santi-blocknRewriteEngine onnRewriteCond %{REQUEST_URI} !santi/*nRewriteCond %{REMOTE_ADDR} !^123.123.123.123nRewriteRule $ /".SANTI_PATH."/block/index.php [R=302,L]n# /santi-block");

    
fclose($f);

    return 
true;
}

function 
unblock() {

    
$f fopen("../../.htaccess""r");

    if(!
$f)
    {
      return 
"-1";
    }
    else
    {
        while(!
feof($f)) 
        { 
            
$text $text.fgets($f);
        }
    }

    
fclose($f);

    
$start stripos($text"# santi-block");
    
$end stripos($text"# /santi-block");
    
$length $end $start 14;

    
$f fopen("../../.htaccess""w+");

    
fwrite($fsubstr_replace($text''$start$length)); 

    
fclose($f);

    return 
true;
}

switch (
$do)
{
    case 
"1"
    {
        die(
checkState());
    } break;
    case 
"2"
    {
        die(
block());
    } break;
    case 
"3"
    {
        die(
unblock());
    } break;
}


?>
Онлайн: 1
Реклама