sub get_admin_html {
     print "\n";
     print "<html><head><title>$roomtitle - Добро пожаловать Евгений!!!.</title>\n";
     print "<link rel='stylesheet' TYPE='text/css' HREF='$cssurl'>\n";
     print "</head><body bgcolor=$messageback text=#FFFFDD vlink=#FFFF00 link=#FFFF00 alink=#FF0000>\n";
     print "<center><hr><h2>Здравствуй Евгений!!<br>This Page Only For Admin Use !</h2><h3>$chatversion \&copy;<br>\n";
     print "<a href=\"mailto:webmaster\@er.agava.ru\">mailto:webmaster\@er.agava.ru</a></h3>\n";
     print "</center>\n";
     print "<form method=POST action='$cgiurl?cf=doadmin'>\n";
print <<FORM;
  <p><input type="text" name="username" size="20"></p>
  <p><input type="radio" value="FullView" checked name="AdminFunc">Посмотреть
  полную инфу<br>
  <input type="radio" name="AdminFunc" value="ClearWall">Очистить стену<br>
  <input type="radio" name="AdminFunc" value="ClearMsg">Очистить сообщения<br>
  <input type="radio" name="AdminFunc" value="MakeKiller">Сделать киллером<br>
  <input type="radio" name="AdminFunc" value="MakeReg">Сделать регом<br>
  <input type="radio" name="AdminFunc" value="Del">Удалить из базы<br>
  <input type="radio" name="AdminFunc" value="LoadHelp">Загрузить помощь<br>
  <input type="radio" name="AdminFunc" value="LoadNews">Загрузить новость<br>
  <input type="radio" name="AdminFunc" value="LoadRules">Загрузить правила</p>
  <p>Пароль: <input type="password" name="password" size="20"></p>
  <p><input type="submit" value="DO IT!" name="SBTN"><br><input type="reset" value="Reset"
  name="RESBTN"></p>
  <p><textarea rows="8" name="upload" cols="55"></textarea></p>
</form>
FORM
     print "<center>\n";
     print "<br> [<a href=\"$htmlurl\" target=\"_top\">ВОЙТИ В ЧАТ</a>]\n";
     print "</center>\n";
     print "</body></html>\n";
}

sub Do_Admin{
      print "\n";
      $psw    = &get_var('password','\n|Ўь');

      if ($psw ne $adminpswd) {
         &error("ОТВАЛИ!! ТЫ НЕ АДМИН!");
         exit 0;
      }

      $wr = &get_var('AdminFunc','\n|Ўь');

      if ($wr eq "ClearWall"){
         open(WALL,">$filehead$wallfile") || die $!;
         close(WALL);
      }

      if ($wr eq "ClearMsg"){
         open(MESSAGE,">$filehead$messagefile") || die;
         close(MESSAGE);
      }

      if ($wr eq "MakeReg"){
         do "$cgipath$cgi_base";
         $user = &get_var('username','\n|Ўь');
         $user=~ tr/a-z/A-Z/;$user=~ tr/а-я/А-Я/;
         &MakeReg($user);
      }

      if ($wr eq "MakeKiller"){
         do "$cgipath$cgi_base";
         $user = &get_var('username','\n|Ўь');
         $user=~ tr/a-z/A-Z/;$user=~ tr/а-я/А-Я/;
         &MakeKiller($user);
      }

      $userlevel=4;
      $allow_html=1;
      if ($wr eq "LoadHelp"){
         $upload = &get_var('upload','');
         open(UPL,">$filehead$help_file") || die $!;
         print UPL $upload;
         close(UPL);
      }

      if ($wr eq "LoadRules"){
         $upload = &get_var('upload','');
         open(UPL,">$filehead$rules_file") || die $!;
         print UPL $upload;
         close(UPL);
      }

      if ($wr eq "LoadNews"){
         $upload = &get_var('upload','');
         open(UPL,">$filehead$news_file") || die $!;
         print UPL $upload;
         close(UPL);
      }

      if ($wr eq "Del"){
         do "$cgipath$cgi_base";
         $user = &get_var('username','\n|Ўь');
         $user=~ tr/a-z/A-Z/;$user=~ tr/а-я/А-Я/;
         &DeleteUser($user);
      }

      if ($wr eq "FullView"){
         do "$cgipath$cgi_base";
         $user = &get_var('username','\n|Ўь');
         $user=~ tr/a-z/A-Z/;$user=~ tr/а-я/А-Я/;
         $temp=&ReadInfoForReg($user);
         print "<html><head><title>$roomtitle - CGI CHAT версия.</title>\n";
         print "<link rel='stylesheet' TYPE='text/css' HREF='$cssurl'>\n";
         print "</head><body bgcolor=$messageback text=#FFFFDD vlink=#FFFF00 link=#FFFF00 alink=#FF0000>\n";
         print "<center><hr><h2>CGI чат!</h2><h3>$chatversion \&copy;<br>\n";
         print "<a href=\"mailto:webmaster\@er.agava.ru\">mailto:webmaster\@er.agava.ru</a></h3>\n";
         print "</center><br>\n";
         print "<table border=0 cellpadding=0 cellspacing=0 width=100%>\n";
         print "<tr><td width=18%>USER NAME</td><td width=82%>- $user</td></tr>";
         print "<tr><td width=18%>LAST IP</td><td width=82%>- $bsip</td></tr>";
         print "<tr><td width=18%>LAST DATE</td><td width=82%>- $bsdate  $bstime</td></tr>";
         print "<tr><td width=18%>PASSWORD</td><td width=82%>- $bspass1</td></tr>";
         print "<tr><td width=18%>STATUS</td><td width=82%>- $bspr</td></tr>";
         print "<tr><td width=18%>FI</td><td width=82%>- $bsfn $bssn</td></tr>";
         print "<tr><td width=18%>ICQ</td><td width=82%>- $bsisq</td></tr>";
         print "<tr><td width=18%>CITY</td><td width=82%>- $bscity</td></tr>";
         print "<tr><td width=18%>MAIL</td><td width=82%>- $bsmail</td></tr>";
         print "<tr><td width=18%>HP</td><td width=82%>- $bshp</td></tr>";
         print "</table>\n";
         print "</body></html>\n";
         exit 0;
      }

print <<FORM;
<html><head><title>$roomtitle администрация</title>
</head><body bgcolor=$messageback text=#FFFFDD vlink=#FFFF00 link=#FFFF00 alink=#FF0000>
<center><hr><h2>Поздравляю !</h2><h3>Всё нормально.<br></h3>
</center>
</body></html>
FORM
}

sub reaction{
$msg="Поздравляю!<br>Операция выполнена<br>";
do "$cgipath$cgi_write_message";
$f= &get_var('func','\n|Ўь');

if ($f eq "banlist"){
	&banlist_html();
	exit 0;
}

if ($f eq "unban"){
        $nk= &get_var('nk','\n|Ўь');
        &unban($nk);
	&banlist_html();
	exit 0;
}

if ($f eq "servermsg"){
    if ($userlevel>=4){
     $reason = &get_var('reason','\n|Ўь');
     $says=$reason;
     &write_message(server);
    }
}

if ($f eq "clear"){
         open(MESSAGE,">$filehead$messagefile") || die;
         close(MESSAGE);
         $reason = &get_var('reason','\n|Ўь');
         $temp="очистил";
         $temp="очистила" if ($usersex eq "Девочка");
         $says="$username $temp чат по причине: $reason";;
         &write_message(server);
}

if ($f eq "kick"){
   $IDT2 = &get_var('toidt','\n|Ўь');
   $reason = &get_var('reason','\n|Ўь');
   $temp=&get_user_info2;
if ($temp eq "yes"){
   if ($userlevel>=$userlevel2){
     &delete_user();
#     $mmm=$username2;
#     $mmm=~ tr/a-z/A-Z/;$mmm=~ tr/а-я/А-Я/;
#     $mmm=&StrToHex($mmm);
     $mmm=$cookie2;
     open(BANLIST,">>$filehead$banlistfile") || die $!;
     print BANLIST "0.0.0.0\|$mmm\|$username2\|$daten\|$reason\|$username\|end\n";
     close(BANLIST);
     $temp="викинул";
     $temp="выкинула" if ($usersex eq "Девочка");
     $says="$username $temp из чата $username2 [$userip2] по причине: $reason";
     &write_message(server);
   } else {$msg="SORRY!<br>Уровнем не вышли.<br>";}
}
}

if ($f eq "del"){
   $IDT2 = &get_var('toidt','\n|Ўь');
   $reason = &get_var('reason','\n|Ўь');
   &get_user_info2;
   if ($userlevel>=$userlevel2){
     &delete_user();
     $mmm=$username2;
     $mmm=~ tr/a-z/A-Z/;$mmm=~ tr/а-я/А-Я/;
     $mmm=&StrToHex($mmm);
     $says="$username удаляет из чата $username2 [$userip2] по причине: $reason";
     &write_message(server);
   } else {$msg="SORRY!<br>Уровнем не вышли.<br>";}
}

if ($f eq "close"){
   $IDT2 = &get_var('toidt','\n|Ўь');
   $reason = &get_var('reason','\n|Ўь');
   $temp=&get_user_info2;
if ($temp eq "yes"){
   if ($userlevel>=$userlevel2){
     &delete_user();
#     $mmm=$username2;
#     $mmm=~ tr/a-z/A-Z/;$mmm=~ tr/а-я/А-Я/;
#     $mmm=&StrToHex($mmm);
     $mmm=$cookie2;
     open(BANLIST,">>$filehead$banlistfile") || die $!;
     print BANLIST "$userip2\|$mmm\|$username2\|$daten\|$reason\|$username\|end\n";
     close(BANLIST);
     $temp="викинул";
     $temp="выкинула" if ($usersex eq "Девочка");
     $says="$username $temp из чата $username2 [$userip2] по причине: $reason";
     &write_message(server);
   } else {$msg="SORRY!<br>Уровнем не вышли.<br>";}
}
}

print <<FORM;
<html><head><title>$roomtitle администрация</title>
</head><body $stdbgimg bgcolor=$onlineback text=$onlineword vlink=#00FFFF link=#00FFFF alink=#00FFFF>
<center><hr>$msg<br>
[<a href="$cgiurl?cf=online$userinfo">НАЗАД</a>]
</center>
</body></html>
FORM
}

