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

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

  $title=$titlepage=$TEXT['support36'];
  require_once "../config.php";
  require_once "top.php";
  ?>
  <title><?php echo $title; ?></title>
  <link rel="StyleSheet" type="text/css" href="../utils/reader.css" />
  </head>
  <body leftmargin="0" marginheight="0" marginwidth="0" rightmargin="0" bottommargin="0" topmargin="0" >
  <?php
  if($result2['user'] == 1) puterror2($TEXT['error-supp11']);
  if($result2['master'] == 1) puterror2($TEXT['error-supp11']);

  if(empty($_GET['time'])) $_GET['time'] = "";
  if(strlen($_GET['time'])>4) puterror2($TEXT['error-supp27']);
  $_GET['time'] = rep($_GET['time']);

  if($_GET['time'] == 30) $time = " AND time_isp < '30' ";
  if($_GET['time'] == 60) $time = " AND time_isp BETWEEN '30' AND '60' ";
  if($_GET['time'] == 300) $time = " AND time_isp BETWEEN '61' AND '300' ";
  if($_GET['time'] == 1440) $time = " AND time_isp BETWEEN '301' AND '1440' ";
  if($_GET['time'] == 1441) $time = " AND time_isp > '1441' ";

  if($_GET['time'] == 30) $time_header = $TEXT['support58'];
  if($_GET['time'] == 60) $time_header = $TEXT['support59'];
  if($_GET['time'] == 300) $time_header = $TEXT['support60'];
  if($_GET['time'] == 1440) $time_header = $TEXT['support61'];
  if($_GET['time'] == 1441) $time_header = $TEXT['support62'];
?>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr align="center"><td class="supp_iniz"><?php echo $TEXT['support79']; ?>&nbsp;<span class="grn"><?php echo $time_header; ?></span></td></tr>
<tr>
    <td align="center">
      <table class="table" border="1" width="60%" cellpadding="1" cellspacing="1">
       <tr class="tableheadercat">
        <td><?php echo $TEXT['support13']; ?></td>
        <td><?php echo $TEXT['support66']; ?></td>
       </tr>
       <?php
       $query_total = "SELECT DISTINCT `tema` FROM `tbl_supp_archive` WHERE `arch_id`>'0' ".$time." ORDER BY tema ";
        $tot_tmp = mysql_query($query_total);
         if(!$tot_tmp) puterror2($TEXT['error-tbl25']);
           while($sost2 = mysql_fetch_array($tot_tmp,MYSQL_ASSOC))
           {
             $query_total2 = "SELECT COUNT(arch_id) AS work FROM tbl_supp_archive WHERE tema = '".$sost2['tema']."' ".$time." ";
              $tot_tmp2 = mysql_query($query_total2);
               if(!$tot_tmp2) puterror2($TEXT['error-tbl25']);
                $work = mysql_fetch_array($tot_tmp2,MYSQL_ASSOC);
                $work_res = $work['work'];

            echo "<tr class='texttable'>
              <td><a href='rpt_user.php?tema=".$sost2['tema']."&time=".$_GET['time']."' title='".$TEXT['support14']."'>".$sost2['tema']."</a></td>
              <td>".$work_res."</td>
            </tr>";

            }
            ?>
        </table>
      </td>
   </tr>
</table>
</body>
</html>