<?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['filter-tit12'];
  $helppage=$TEXT['filter-help1'];
  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(strlen($_GET['familiya'])>200) puterror2($TEXT['error-user12']);
  if(strlen($_GET['name'])>200) puterror2($TEXT['error-user14']);
  if(strlen($_GET['otchestvo'])>200) puterror2($TEXT['error-user15']);
  if(strlen($_GET['mail'])>100) puterror2($TEXT['error-user18']);
  if(strlen($_GET['city'])>120) puterror2($TEXT['error-city2']);
  if(strlen($_GET['street'])>200) puterror2($TEXT['error-str2']);
  if(strlen($_GET['house'])>80) puterror2($TEXT['error-house2']);
  if(strlen($_GET['room'])>64) puterror2($TEXT['error-user22']);
  if(strlen($_GET['scribe'])>8) puterror2($TEXT['error-user24']);
  if(strlen($_GET['phonem'])>30) puterror2($TEXT['error-user19']);
  if(strlen($_GET['phonec'])>30) puterror2($TEXT['error-user20']);
  if(strlen($_GET['phonei'])>20) puterror2($TEXT['error-user21']);
  if(strlen($_GET['org'])>400) puterror2($TEXT['error-org4']);
  if(strlen($_GET['upr'])>400) puterror2($TEXT['error-upr4']);
  if(strlen($_GET['otd'])>280) puterror2($TEXT['error-otd3']);
  if(strlen($_GET['post'])>120) puterror2($TEXT['error-post3']);
  if(strlen($_GET['visible'])>4) puterror2($TEXT['error-user23']);
  if(strlen($_GET['big'])>1) puterror2($TEXT['usr-big-err']);
  $_GET['familiya'] = rep($_GET['familiya']);
  $_GET['name'] = rep($_GET['name']);
  $_GET['otchestvo'] = rep($_GET['otchestvo']);
  $_GET['mail'] = rep($_GET['mail']);
  $_GET['city'] = rep($_GET['city']);
  $_GET['street'] = rep($_GET['street']);
  $_GET['house'] = rep($_GET['house']);
  $_GET['room'] = rep($_GET['room']);
  $_GET['scribe'] = rep($_GET['scribe']);
  $_GET['phonem'] = rep($_GET['phonem']);
  $_GET['phonec'] = rep($_GET['phonec']);
  $_GET['phonei'] = rep($_GET['phonei']);
  $_GET['org'] = rep($_GET['org']);
  $_GET['upr'] = rep($_GET['upr']);
  $_GET['otd'] = rep($_GET['otd']);
  $_GET['post'] = rep($_GET['post']);
  $_GET['visible'] = rep($_GET['visible']);

?>
 <p><?php echo $TEXT['city-text1'] ;?></p>
 <table class="table" border="1" cellpadding="3" cellspacing="0" width="40%">
<?php
     $query = "SELECT * FROM `tbl_city` ORDER BY `city`";
     $result = mysql_query($query);
     if(!$result) puterror2($TEXT['error-tbl1']);
       if(mysql_num_rows($result)>0);
         {
           ?>
           <tr class='tableheadercat' align=center>
             <td><?php echo $TEXT['tbl-city']; ?></td>
             <td><?php echo $TEXT['analiz-op']; ?></td>
           </tr>
           <?php
             while($result_citys = mysql_fetch_array($result,MYSQL_ASSOC))
              {
              $add = "<a href='index.php?familiya=".$_GET['familiya']."&name=".$_GET['name']."&otchestvo=".$_GET['otchestvo']."&mail=".$_GET['mail']."&city=".$result_citys['city']."&street=".$_GET['street']."&house=".$_GET['house']."&room=".$_GET['room']."&scribe=".$_GET['scribe']."&phonem=".$_GET['phonem']."&phonec=".$_GET['phonec']."&phonei=".$_GET['phonei']."&org=".$_GET['org']."&upr=".$_GET['upr']."&otd=".$_GET['otd']."&post=".$_GET['post']."&visible=".$_GET['visible']."&amp;big=".$_GET['big']."' title='".$TEXT['filter-tit10']."'>".$TEXT['btn_add']."</a>";
           ?>
           <tr class='tabledata' align=center onmouseover="this.style.backgroundColor='#cccccc';" onmouseout="this.style.backgroundColor='#ffffff';">
              <td><?php echo $result_citys['city']; ?></td>
              <td><?php echo $add; ?></td>
           </tr>
           <?php
              }
         }
?>
</table>
</body>
</html>