Файл: admin.php
Строк: 149
<?
#######################
## © By bambi_no4462 ##
#######################
session_start();
@include_once('files/config.php');
@include_once('files/func.php');
@header('Content-Type: text/html; charset=utf-8');
if(!empty($_POST['admin_login']) and $_SESSION['no_auth']>time()){
$_SESSION['error'] = "Доступ к админке временно заблокирован! <br> Попробуйте вернуться в течении 60 мин.";
@header("Location: /admin.php?mod=auth"); exit;
}
elseif(!empty($_POST['admin_login']) and $_SESSION['error_auth']>5){
$_SESSION['no_auth']=(time()+3600);
$_SESSION['error_auth']=0;
$_SESSION['error'] = "Слишком много попыток авторизации! <br> Доступ к админке временно заблокирован!";
@header("Location: /admin.php?mod=auth"); exit;
}
elseif(!empty($_POST['admin_login']) and ($_POST['admin_login']!=$admin_login or $_POST['admin_password']!=$admin_password)){
$_SESSION['error'] = 'Логин или пароль введён неверно';
$_SESSION['error_auth']++;
@header("Location: /admin.php?mod=auth"); exit;
}
elseif(!empty($_POST['admin_login'])){
setcookie("admin_login", $_POST['admin_login'], time() + 3600 * 24 * 21 );
setcookie("admin_password", $_POST['admin_password'], time() + 3600 * 24 * 21 );
@header("Location: /admin.php?"); exit;
}
if(isset($_GET['exit'])){
setcookie("admin_login", null, time() + 3600 * 24 * 21 );
setcookie("admin_password", null, time() + 3600 * 24 * 21 );
@header("Location: /admin.php?"); exit;
}
if($_GET['mod']!='auth' and ($_COOKIE['admin_login']!=$admin_login or $_COOKIE['admin_password']!=$admin_password)){
@header("Location: /admin.php?mod=auth"); exit;}
elseif($_GET['mod']=='auth' and $_COOKIE['admin_login']=="$admin_login" and $_COOKIE['admin_password']=="$admin_password"){
@header("Location: /admin.php?"); exit;}
if($_GET['go']!='add')
{$_get_panel_ = "
<div class='switcher_link left selected'>Валидные</div>
<div class='switcher_link right'><a href='$_SERVER[PHP_SELF]?mod=index&go=add'>Все аккаунты</a></div>"; $_include = $_validate_accounts; }else
{$_get_panel_ = "
<div class='switcher_link left'><a href='$_SERVER[PHP_SELF]?mod=index'>Валидные</a></div>
<div class='switcher_link right selected'>Все аккаунты</div>"; $_include = $_all_accounts; }
if(!empty($_GET['go'])){ $_get_go = "&go=$_GET[go]"; }
switch ($_GET['mod']){
default:
@header("Location: $_SERVER[PHP_SELF]?mod=index$_get_go"); exit;
break;
case'index':
@include_once('files/head.php');
echo"
<div id='vk_wrap' class='_vpan qs_enabled'>
<div class='mhead'>
<div class='hb_btn mhi_logo'>
<center> Админка <span style='float:right; padding-right:15px;'><a href='/admin.php?exit'>Выход</a></span> </center>
</div>
</div>
$_get_panel_
<div class='txt'>
<div class='text_panel'>
<b>Аккаунты:</b> (".abs(@count(file($_include))).")
</div>
<div class='mcont'>
<div class='form_item fi_fat'>
<form action='$_SERVER[PHP_SELF]?mod=check$_get_go' method='post'>
<textarea name='zin' class='textfield' style='height:4.4em;'>
";
@include("$_include");
echo"
</textarea>
<center>
<input type='submit' class='button wide_button'style='margin:5px' value='Удалить повторы'>
</form>
</center>
</div>
</div>
</div>
</div>
";
break;
case'check':
$fh = @fopen($_include,'r+') or die('Error 1');
$_new=null;
while($s = fgets($fh,1024)){
if(empty($_povtor[$s]) and mb_strlen(trim(mb_strtolower(($s),'utf-8')))>1)
{
$_povtor[$s]=1;
$_new.=$s;
}
}
@fclose($fh) or die('Error 2');
$fh = @fopen($_include,'w+');
@fwrite($fh,$_new) or die('Error 3');
@fclose($fh) or die('Error 4');
$_SESSION['msg']="Аккаунты успешно прочеканы";
@header("Location: $_SERVER[PHP_SELF]?mod=index$_get_go");
exit;
break;
case'auth':
@include_once('files/head.php');
echo"
<div id='vk_wrap' class='_vpan qs_enabled'>
<div class='mhead'>
<div class='hb_btn mhi_logo'>
<center> Авторизация в админке </center>
</div>
</div>
<div class='txt'>
<div class='mcont'>
<div class='form_item fi_fat'>
<form method='post'>
<br><b>Логин</b>: <br><input type='text' name='admin_login' class='textfield' value='admin'>
<br><b>Пароль</b>: <br><input type='password' name='admin_password' class='textfield' value=''>
<p align='center'><input type='submit' class='button wide_button' name='ok' value='Войти'></p>
</form>
</div>
</div>
</div>
</div>
</div>
";
break;
}
@include_once('files/down.php');
?>