<?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['forecast-title'];
  $helppage=$TEXT['forecast-help'];
  require_once "../config.php";
  require_once "../util/top.php";

  if($result2['master'] == 1) puterror2($TEXT['error-loginform4']);
  if($result2['manager'] == 1) puterror2($TEXT['error-loginform4']);
?>
 <img alt="<?php echo $TEXT['forecast-add-new2'] ;?>" src= "../img/parse.png" height="15" align="top" /><a class="boldit" href="parser.php" title="<?php echo $TEXT['forecast-add-new-tit2']; ?>"><?php echo $TEXT['forecast-add-new2'] ;?></a><br />
 <img alt="<?php echo $TEXT['forecast-add-new'] ;?>" src= "../img/insert.png" height="15" align="top" /><a class="boldit" href="addform.php" title="<?php echo $TEXT['forecast-add-new-tit']; ?>"><?php echo $TEXT['forecast-add-new'] ;?></a>
 <br />
 <br />
 <span class="tabledata"><?php echo $TEXT['forecast-text1'] ;?></span>
<table class="table" border="1" cellpadding="3" cellspacing="0" width="70%">
<?php
     $query = "SELECT id, station, country, region, dat FROM `tbl_forecast` ORDER BY station, dat DESC";
     $result = mysql_query($query);
     if(!$result) puterror2($TEXT['error-tbl21']);
       if(mysql_num_rows($result)>0);
         {
           ?>
           <tr class="tableheadercat">
             <td><?php echo $TEXT['tbl-station']; ?></td>
             <td width="15%"><?php echo $TEXT['tbl-date']; ?></td>
             <td><?php echo $TEXT['tbl-region']; ?></td>
             <td><?php echo $TEXT['tbl-country']; ?></td>
             <td colspan=2><?php echo $TEXT['tbl-action']; ?></td>
           </tr>
           <?php
             while($result_forecast = mysql_fetch_array($result,MYSQL_ASSOC))
              {
              $edit = "<a href=editform.php?id=".$result_forecast['id']." title='".$TEXT['tbl-edit-tit-forec']."'>".$TEXT['tbl-edit']."</a>";
              $delete = "<a href=delete.php?id=".$result_forecast['id']." title='".$TEXT['tbl-delete-tit-forec']."'>".$TEXT['tbl-delete']."</a>";
           ?>
           <tr class="tabledata" onmouseover="this.style.backgroundColor='#cccccc';" onmouseout="this.style.backgroundColor='#ffffff';">
              <td><?php echo $result_forecast['station']; ?></td>
              <td><?php echo $result_forecast['dat']; ?></td>
              <td><?php echo $result_forecast['region']; ?></td>
              <td><?php echo $result_forecast['country']; ?></td>
              <td><?php echo $edit; ?></td>
              <td><?php echo $delete; ?></td>
           </tr>
           <?php
              }
         }
?>
</table>
<?php
  require_once "../util/bottom.php";
?>