<?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['login-title2'];
  $helppage = "";

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

  if($result2['administrator'] == 0) puterror2($TEXT['error-loginform2']);

  if(empty($_GET['login_id'])) puterror2($TEXT['error-login15']);
  if(strlen($_GET['login_id'])>50) puterror2($TEXT['error-login14']);
  $_GET['login_id'] = rep($_GET['login_id']);

  //*************************************
  $query = "SELECT login AS dele_login, fullname AS dele_name FROM `tbl_logins` WHERE `login_id`='".$_GET['login_id']."' ";
  $result = mysql_query($query);
   if(!$result) puterror2($TEXT['error-tbl20']);
      $result4 = mysql_fetch_array($result);
      $fio = trim($result4['dele_name']);
              if($fio == "") $fio = " ( --- ) ";
               else $fio = " ( ".$fio." ) ";

  $ip = $_SERVER['REMOTE_ADDR'];
  $doing = $TEXT['log-login2'];
  $what = $result4['dele_login'].$fio.$TEXT['log-id'].$_GET['login_id'];
  $who = $result2['fullname'];
  //*************************************
  $query = "DELETE FROM `tbl_logins` WHERE `login_id`='".$_GET['login_id']."' 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 puterror2($TEXT['error-log']);
  } else puterror2($TEXT['error-login7']);
  require_once "../util/bottom.php";
?>
