Location: PHPKode > projects > Eubirdb - birdwatching DB and software > eubirdb-0.2.0-alpha/php/cross_advanced.php
<?
/*
    Copyright (C) 2004 Mauro Franzoni

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

include "inc/database.php";
include "inc/connect.php";
include "inc/copyright.php";
?>
<html>
<head>
<title><?=$PROG?> - elenco avanzato</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
<font face="Arial, Helvetica, sans-serif" size="4"><b><?=$PROG?></b></font>
<center>
<?

$font='<font face="Arial, Helvetica, sans-serif" size="2">';
$efont='</font>';

if ($Result) {
?>
<table border="1" cellspacing="0">
<?
   include "inc/crosslist.php";
   $Table = $DBfix."eubirdb_crosslist";

   $query="SELECT ";
   if (isset($columns)) {
     $fields = array();
     $descr = array();
     for ($i = 0; $i < count($columns); $i++) {
       $fields[] = $checklist_afields[$columns[$i]];
       $descr[] = $checklist_adescr[$columns[$i]];
     }
   } else {
     $fields = $checklist_afields;
     $descr = $checklist_adescr;
   }
   echo "  <tr>\n";
   for ($i = 0; $i < count($fields); $i++) {
      if ($i > 0) {
          $query .= ',';
      }
      $query .= " $fields[$i]";
      echo "    <th>$font$descr[$i]$efont</th>\n";
   }
   echo "  </tr>\n";

   $query .= " FROM $Table";

   if (isset($orderby)) {
     $query .= " ORDER BY ";
     for ($i = 0; $i < count($orderby); $i++) {
         if ($i > 0) {
             $query .= ',';
         }
         $query .= $orderby[$i];
     }
   }

   if (!isset($NumEntries)) {
       $NumEntries = 10;
   }
   if (!isset($StartIndex)) {
      $StartIndex = 0;
   } 
   $NextIndex = $StartIndex + $NumEntries;

   $query .= " LIMIT $StartIndex,$NumEntries;";

   if ($Result = mysql_query($query, $Session)) {

      for ($count = 0; $row=mysql_fetch_row($Result); $count++) {
         echo "  <tr>\n";
         for ($i = 0; $i < count($fields); $i++) {
            echo "    <td>$font".htmlentities($row[$i])."$efont</td>\n";
         }
         echo "  </tr>\n";
      }
      $LastIndex = $StartIndex + $count;
   } else {
      $LastIndex = -1;
?>
  <h1>errore di accesso al database</h1>
  <h2><? echo $query ?></h2>
  <h3><? echo mysql_error(); ?><br>
  si prega di segnalare l'errore al <a href="mailto:hide@address.com">webmaster</a>
  </h3>
<?
   }

?>
  <tr>
    <td colspan="<? echo count($fields); ?>">
      <table border="0" cellspacing="0" cellpadding="0"
       width="100%" vspace="0" hspace="0">
      <tr>
      <td align="center" width="33%">
<?
      if ($StartIndex > 0) {
         if (($PrevIndex = $StartIndex - $NumEntries) < 0) {
            $PrevIndex = 0;
         }
?>
      <form name="page" action="<?=$PHP_SELF?>" method="post">
      <input type="hidden" name="eubirdb_lang" value="<?=@$eubirdb_lang?>">
      <input type="hidden" name="StartIndex" value="<? echo $PrevIndex; ?>">
      <input type="hidden" name="NumEntries" value="<? echo $NumEntries; ?>">
      <input type="hidden" name="Cmd" value="<? echo $Cmd; ?>">
      <input type="submit" value="<<">
<?
      for ($i = 0; $i < count($orderby); $i++) {
         if ($i > 0) {
             $query .= ',';
         }
?>
         <input type="hidden" name="orderby[]" value="<? echo $orderby[$i]; ?>">
<?
      }
      for ($i = 0; $i < count($columns); $i++) {
         if ($i > 0) {
             $query .= ',';
         }
?>
         <input type="hidden" name="columns[]" value="<? echo $columns[$i]; ?>">
<?
      }
?>
      </form>
<?
      } else {
?>
      &nbsp;
<?
      }
?>
      </td>
      <td align="center" width="34%">
      <form action="cross.php" method="post">
      <input type="hidden" name="eubirdb_lang" value="<?=@$eubirdb_lang?>">
      <input type="submit" value="indice">
      </form>
      </td>
      <td align="center" width="33%">
<?
      if ($NextIndex <= $LastIndex) {
?>
      <form name="page" action="<?=$PHP_SELF?>" method="post">
      <input type="hidden" name="eubirdb_lang" value="<?=@$eubirdb_lang?>">
      <input type="hidden" name="StartIndex" value="<? echo $NextIndex; ?>">
      <input type="hidden" name="NumEntries" value="<? echo $NumEntries; ?>">
      <input type="hidden" name="Cmd" value="<? echo $Cmd; ?>">
      <input type="submit" value=">>">
<?
      for ($i = 0; $i < count($orderby); $i++) {
         if ($i > 0) {
             $query .= ',';
         }
?>
         <input type="hidden" name="orderby[]" value="<? echo $orderby[$i]; ?>">
<?
      }
      for ($i = 0; $i < count($columns); $i++) {
         if ($i > 0) {
             $query .= ',';
         }
?>
         <input type="hidden" name="columns[]" value="<? echo $columns[$i]; ?>">
<?
      }
?>
      </form>
<?
      } else {
?>
      &nbsp;
<?
      }
?>
      </td>
      </tr>
      </table>
    </td>
  </tr>     
</table>
<?
} else {
?>
  <h1>errore connessione al database</h1>
  <h3><? echo mysql_error(); ?><br>
      si prega di segnalare l'errore al <a href="mailto:hide@address.com">webmaster</a>
  </h3>
<?
}
?>
<p align="center"><a href="mailto:hide@address.com">Per segnalazioni</a></p>

<? PROGnotice(@$GNUGPL) ?>
</center>
</body>
</html>
Return current item: Eubirdb - birdwatching DB and software