<?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['top2-all-users'];

  require_once "config.php";
  require_once "utils/top_photoalb_all.php";

  if(strlen($_GET['org_id'])>11) puterror($TEXT['error-org']);
  $_GET['org_id'] = rep($_GET['org_id']);
  if(!empty($_GET['org_id'])) $org_id = " AND `org_id` = '".$_GET['org_id']."'";
   else $org_id = "";
?>
<table border="0" width="87%">
<?php
  $query = "SELECT `user_id`, `familiya`, `name`, `otchestvo`, `visible`, `photo` FROM `tbl_users` WHERE `visible` = 'show' ".$org_id." ORDER BY familiya ";
  $users = mysql_query($query);
         if(!$users) puterror($TEXT['error-tbl2']);
           if(mysql_num_rows($users)>0)
            {
             $td = 0;
             while($user = mysql_fetch_array($users,MYSQL_ASSOC))
              {
               $usrpho = preg_replace("/\.\.+./","",$user['photo']);
               if(!empty($user['photo']) && file_exists($usrpho))
                {
                 if ($td == 0)
                 {
                  echo "<tr>";
                 }
                 if($td < 7) 
                 {
                 ?>
<td>
<table border=0 width=100%>
 <tr align=center>
  <td><a href=# onClick="window.open('user.php?user_id=<?php echo $user['user_id']; ?>','popup','top=<?php echo $TEXT['user-top']; ?>,left=<?php echo $TEXT['user-left']; ?>,width=<?php echo $TEXT['user-width']; ?>,height=<?php echo $TEXT['user-height']; ?>,status=no,scrollbars=no,location=no,menubar=no,toolbar=no')" title="<?php echo $user['familiya']; ?> <?php echo $user['name']; ?> <?php echo $user['otchestvo']; ?>"><img width='130' height='185' src="<?php echo $usrpho; ?>"></a>
   </td>
  </tr>
</table>
</td><?php
                 $td++;
                 }
                 if ($td == 7)
                 {
                  echo "</tr>";
                  $td = 0;
                 }
               }
             }
             if ($td > 0 && $td < 7)
              {
              echo "</tr>";
              }
           }
?>
</table>
<?php
  require_once "utils/bottom.php";
?>