<?php
  ///////////////////////////////////////////////////
  //2009 (C)
  //Карпухин Павел
  ///////////////////////////////////////////////////
  require_once "../utils/chlang.php";

  $title = $TEXT['dbchk'];

require_once "../config_a.php";
require_once "../utils/functions.php";
require_once "../utils/top_adm_film.php";

if($result2['administrator'] == 0) {puterror($result2['skin'],$TEXT['error-loginform2']); require_once "../utils/bottom_adm_film.php"; exit();}

$tbls = mysqli_query($dbcnx,"SHOW TABLES FROM $dbname");
  while($all = mysqli_fetch_array($tbls))
      {
      $i .=$all['0'].", ";
      }
     $all_tbls=substr($i, 0,-2);
?>
<table align="center" class="table" border="0" cellpadding="0" cellspacing="0" width="80%">
<tr><td>
<fieldset>
<legend align="left" title="<?php echo $TEXT['chec-tit2']; ?>"><?php echo $TEXT['chec_text']; ?></legend>
<table align="center" class="table" border="1" cellpadding="0" cellspacing="0" width="100%">
<?php
  $query = "CHECK TABLE $all_tbls MEDIUM";
     $result = mysqli_query($dbcnx,$query);
      if(!$result) {puterror($result2['skin'],$TEXT['error-chec']); require_once "../utils/bottom_adm_film.php"; exit();}
?>
           <thead>
           <tr class='tableheadercat'>
             <td width="40%"><?php echo $TEXT['analiz-tab']; ?></td>
             <td><?php echo $TEXT['analiz-op']; ?></td>
             <td><?php echo $TEXT['analiz-msg-type']; ?></td>
             <td><?php echo $TEXT['analiz-msg-text']; ?></td>
             <td><?php echo $TEXT['tbl-action']; ?></td>
           </tr>
           </thead>
           <tbody id="tab">
<?php
       while($result_analiz = mysqli_fetch_array($result))
              {
               $repair = "<a href=repair.php?tbl=".$result_analiz['Table']." title='".$TEXT['rep-tit3']."'>".$TEXT['rep_text2']."</a>";

               $result_analiz1 = $result_analiz['Table'];
               $result_analiz2 = $result_analiz['Op'];
               $result_analiz3 = $result_analiz['Msg_type'];
               $result_analiz4 = $result_analiz['Msg_text'];

               if ($result_analiz['Msg_type'] == "status")
               {
?>
           <tr>
              <td><?php echo $result_analiz1; ?></td>
              <td><?php echo $result_analiz2; ?></td>
              <td><?php echo $result_analiz3; ?></td>
              <td><?php echo $result_analiz4; ?></td>
              <td><?php echo $repair; ?></td>
           </tr>
<?php
               }
               if ($result_analiz['Msg_type'] == "warning")
               {
?>
           <tr>
              <td><?php echo $result_analiz1; ?></td>
              <td><?php echo $result_analiz2; ?></td>
              <td><?php echo $result_analiz3; ?></td>
              <td><?php echo $result_analiz4; ?></td>
              <td><?php echo $repair; ?></td>
           </tr>
<?php
               }
               if ($result_analiz['Msg_type'] == "error")
               {
?>
           <tr>
              <td><?php echo $result_analiz1; ?></td>
              <td><?php echo $result_analiz2; ?></td>
              <td><?php echo $result_analiz3; ?></td>
              <td><?php echo $result_analiz4; ?></td>
              <td><?php echo $repair; ?></td>
           </tr>
<?php
               }
              }
              echo "</tbody>";
            //*************************************
            //Информация для лога
            $ip = $_SERVER['REMOTE_ADDR'];
            $doing = $TEXT['log-chec1'];
            $what = $TEXT['log-chec2'];
            $who = $result2['familiya']." ".$result2['name'];
            //*************************************
            $query2 = "INSERT INTO tbl_logs ( `log_id` , `data` , `ip` , `who` , `doing` , `what` ) VALUES ( NULL , NOW() , '$ip' , '$who' , '$doing' , '$what')";
            if(!mysqli_query($dbcnx,$query2)) {puterror($result2['skin'],$TEXT['error-log']); require_once "../utils/bottom_adm_film.php"; exit();}
?>
</table>
</fieldset>
</td></tr>
</table>
<?php
  require_once "../utils/bottom_adm_film.php";
?>