Размер файла: 3.52Kb
<?php
/*\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\//
// Sitchi CMS - Mobile Content Management System //
// The author: Nikoloz Sitchinava [sitchi] //
// Link: http://sitchicms.num.ge //
// Skype: SitchiCMS //
// License: LICENSE.txt (see attached file) //
// Version: VERSION.txt (see attached file) //
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
define('_SITCHICMS', 1);
$root_path='../';
require $root_path.'includes/db_connect.php';
require $root_path.'includes/start.php';
require $root_path.'includes/header.php';
require $root_path.'includes/functions.php';
require $root_path.'includes/head.php'; // თავი
$lng_a = load_lng('admin');
if($user['level']<4)
header("Location: /");
head(''.$lng['1_54'].' | '.$lng_a['1_56'].'');
echo'<div class="hdr"><b>'.$lng_a['1_56'].'</b></div>';
if (isset($_POST['min']) && isset($_POST['max']))
{
if (!preg_match("/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i",$_POST['min']))
$err[] = '<div class="errmenu">'.$lng_a['1_57'].'</div>';
if (!preg_match("/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i",$_POST['max']))
$err[] = '<div class="errmenu">'.$lng_a['1_57'].'</div>';
$min=ip2long($_POST['min']);
$max=ip2long($_POST['max']);
if (ip2long($ip)>=$min && ip2long($ip)<=$max)
{
$err[] = '<div class="errmenu">'.$lng_a['1_58'].'</div>';
}
if (!isset($err))
{
mysql_query("INSERT INTO `ban_ip` (`min`, `max`) values('$min', '$max')",$dblink);
msg ('<div class="menu">'.$lng_a['1_59'].'</div>');
}}
if (isset($_GET['delmin']) && isset($_GET['delmax']) &&
mysql_result(mysql_query("SELECT COUNT(*) FROM `ban_ip` WHERE `min` = '".mres($_GET['delmin'])."' AND `max` = '".mres($_GET['delmax'])."' LIMIT 1",$dblink), 0)!=0)
{
mysql_query("DELETE FROM `ban_ip` WHERE `min` = '".mres($_GET['delmin'])."' AND `max` = '".mres($_GET['delmax'])."' LIMIT 1");
mysql_query("OPTIMIZE TABLE `ban_ip`");
msg('<div class="menu">'.$lng_a['1_60'].'</div>');
}
err();
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `ban_ip`"),0);
$k_page=k_page($k_post,$set['p_count']);
$page=page($k_page);
$start=$set['p_count']*$page-$set['p_count'];
$q=mysql_query("SELECT * FROM `ban_ip` LIMIT $start, $set[p_count]");
if ($k_post==0)
{
echo'<div class="errmenu">' .
''.$lng_a['1_61'].'' .
'</div>';
}
while ($post = mysql_fetch_assoc($q))
{
echo'<div class="menu">';
echo long2ip($post['min']).' - '.long2ip($post['max']);
echo'<a href="?page=$page&delmin='.$post['min'].'&delmax='.$post['max'].'"> '.$lng_a['1_62'].'</a><br/>';
echo'</div>';
}
if ($k_page>1)str('?',$k_page,$page); // გვერდების გამოტანა
$min=NULL;
$max=NULL;
if (isset($_GET['min']) && preg_match("^([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3})$",long2ip($_GET['min'])))
{
echo"HOST: ".gethostbyaddr(long2ip($_GET['min']))."<br/>\n";
$min=long2ip($_GET['min']);
$max=long2ip($_GET['min']);
if (isset($_GET['max']) && preg_match("^([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3})$",long2ip($_GET['max'])))$max=long2ip($_GET['max']);
}
echo'<form method="post" action="?"><div class="egmenu">' .
''.$lng_a['1_63'].':<br/><input name="min" size="16" value="'.$min.'" type="text" /><br/>' .
''.$lng_a['1_64'].':<br/><input name="max" size="16" value="'.$max.'" type="text" /><br/>' .
'<input value="'.$lng_a['1_65'].'" type="submit" />' .
'</div></form>';
echo'<a href="/apanel/">'.$lng['1_54'].'</a>';
require $root_path.'includes/end.php'; // დასასრული
?>