<?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-title4'];
  $helppage = $TEXT['forecast-help4'];

  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']);

  if(!isset($title)) $title = $TEXT['forecast-title4'];
  if(!isset($button)) $button = $TEXT['btn_edit'];
  if(!isset($action)) $action = "edit.php";

  if(strlen($_GET['id'])>11) puterror2($TEXT['error-forecast6']);
  $_GET['id'] = rep($_GET['id']);

  $old_id = $_GET['id'];

  $query = "SELECT * FROM `tbl_forecast` WHERE `id`='".$_GET['id']."' ";
  $result = mysql_query($query);
  if (!$result) puterror2($TEXT['error-tbl21']);
    $result2 = mysql_fetch_array($result);
         $ind = $result2['ind'];
         $country = $result2['country'];
         $region = $result2['region'];
         $station = $result2['station'];
         $dat = $result2['dat'];
         $tday = $result2['tday'];
         $tnight = $result2['tnight'];
         $prec = $result2['prec'];
         $prec_prob = $result2['prec_prob'];
         $wind_dir = $result2['wind_dir'];
         $wind_speed = $result2['wind_speed'];
         $weather_cond = $result2['weather_conditions'];
         $pday = $result2['pday'];
         $pnight = $result2['pnight'];
?>
<form enctype='multipart/form-data' action=<?php echo $action; ?> method=post>
<table>
<tr><td class="useraddedit"><?php echo $TEXT['ind']; ?></td><td class="useraddedit"><input size=10 maxlength=9 type=text name=ind value='<?php echo $ind; ?>'></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['tbl-country']; ?></td><td class="useraddedit"><input size=30 maxlength=85 type=text name=country value='<?php echo $country; ?>'></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['tbl-region']; ?></td><td class="useraddedit"><input size=30 maxlength=85 class="inputmandatory" type=text name=region value='<?php echo $region; ?>'></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['tbl-station']; ?></td><td class="useraddedit"><input size=30 maxlength=85 class="inputmandatory" type=text name=station value='<?php echo $station; ?>'></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['tbl-date']; ?></td><td class="useraddedit"><input size=10 maxlength=10 class="inputmandatory" type=text name=dat value='<?php echo $dat; ?>' title="<?php echo $TEXT['forecast-dat']; ?>"></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['tday']; ?></td><td class="useraddedit"><input size=10 maxlength=6 type=text name=tday value='<?php echo $tday; ?>'></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['tnight']; ?></td><td class="useraddedit"><input size=10 maxlength=6 type=text name=tnight value='<?php echo $tnight; ?>'></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['prec']; ?></td><td class="useraddedit"><input size=10 maxlength=6 type=text name=prec value='<?php echo $prec; ?>'></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['prec_prob']; ?></td><td class="useraddedit"><input size=10 maxlength=6 type=text name=prec_prob value='<?php echo $prec_prob; ?>'></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['wind_dir']; ?></td><td class="useraddedit">
<select class="input" name=wind_dir >
  <option value=15 <?php if($wind_dir==15) echo "selected"; ?>><?php echo $TEXT['forecast_n']; ?>
  <option value=40 <?php if($wind_dir==40) echo "selected"; ?>><?php echo $TEXT['forecast_ne']; ?>
  <option value=100 <?php if($wind_dir==100) echo "selected"; ?>><?php echo $TEXT['forecast_e']; ?>
  <option value=140 <?php if($wind_dir==140) echo "selected"; ?>><?php echo $TEXT['forecast_se']; ?>
  <option value=170 <?php if($wind_dir==170) echo "selected"; ?>><?php echo $TEXT['forecast_s']; ?>
  <option value=220 <?php if($wind_dir==220) echo "selected"; ?>><?php echo $TEXT['forecast_sw']; ?>
  <option value=270 <?php if($wind_dir==270) echo "selected"; ?>><?php echo $TEXT['forecast_w']; ?>
  <option value=315 <?php if($wind_dir==315) echo "selected"; ?>><?php echo $TEXT['forecast_nw']; ?>
</select></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['wind_speed']; ?></td><td class="useraddedit"><input size=10 maxlength=6 type=text name=wind_speed value='<?php echo $wind_speed; ?>'></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['weather_cond']; ?></td><td class="useraddedit"><input size=30 maxlength=85 type=text name=weather_cond value='<?php echo $weather_cond; ?>'></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['pday']; ?></td><td class="useraddedit"><input size=10 maxlength=6 type=text name=pday value='<?php echo $pday; ?>'></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['pnight']; ?></td><td class="useraddedit"><input size=10 maxlength=6 type=text name=pnight value='<?php echo $pnight; ?>'></td></tr>
<tr><td></td><td>
<input class=button type=submit value='<?php echo $button; ?>' />
<input type=hidden name=id value='<?php echo $old_id; ?>' />
</td></tr>
</table>
</form>
<?php
  require_once "../util/bottom.php";
?>