<?php
  ///////////////////////////////////////////////////
  //2007 (C)
  //Карпухин Павел
  ///////////////////////////////////////////////////

  $lang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0,2);
  if (is_file ("../../lang/".$lang."/".$lang.".php")) include "../../lang/".$lang."/".$lang.".php";
     else include "../../lang/ru/ru.php";

  $title=$titlepage = $TEXT['bllst-text4'];
  $helppage = "";

  require_once "../../config.php";
  require_once "../../util/top_layer2.php";

  if($result2['administrator'] == 0) puterror3($TEXT['error-loginform4']);

  if(empty($_GET['hostname'])) puterror3($TEXT['hostlst-error1']);
  if(strlen($_GET['hostname'])>65) puterror3($TEXT['hostlst-error2']);
  $_GET['hostname'] = rep($_GET['hostname']);

  //*************************************
  $query = "SELECT * FROM `hostlists` WHERE `hostname`='".$_GET['hostname']."' ";
  $result = mysql_query($query);
  if (!$result) puterror3($TEXT['error-tbl30']);
      $result2 = mysql_fetch_array($result);

  $ip = $_SERVER['REMOTE_ADDR'];
  $doing = $TEXT['log-ex-host-del'];
  $what = $result2['hostname']." (".$result2['type'].")";
  $who = $result2['fullname'];
  //*************************************

  $query = "DELETE FROM `hostlists` WHERE `hostname`='".$_GET['hostname']."' LIMIT 1";
  if(mysql_query($query))
  {
    $query2 = "INSERT INTO tbl_logs ( `log_id` , `data` , `ip` , `who` , `doing` , `what` ) VALUES ( NULL , NOW() , '$ip' , '$who' , '$doing' , '$what')";
        if(mysql_query($query2))
           {
             echo "<html><head>
                   <meta HTTP-EQUIV='Refresh' CONTENT='0; URL=index.php' />
                   </head></html>";
           } else puterror3($TEXT['error-log']);
  } else puterror3($TEXT['error-tbl30']);
  require_once "../../util/bottom.php";
?>
