Location: PHPKode > projects > Open Biblio > biblio2/locationadd.php
<?php
/* OpenBIBLIO -- A library administration web interface
 * Copyright (C) 2002 Fr&eacute;d&eacute;ric Descamps
 *
 * 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.
 */

 $sw		= $_POST['sw'];
 $local		= $_POST['local'];
 $biblio	= $_POST['biblio'];
 $rangee	= $_POST['rangee']; 
 
                        if($sw==1)
                        {                       
                          $requete = "select * from locations where local ='$local' and biblio = '$biblio' and rangee = '$rangee'";
                          $resultat = biblio_db_query($requete);
                          $trouve=biblio_db_num_rows($resultat);
                          if ($trouve > 0)
                          {
                           echo "<CENTER><BR>";
			   echo _("L'emplacement <b>$local --> $biblio --> $rangee</b> est d&eacute;jà existant dans la base de donn&eacute;es, recommencez!");
			   echo "<BR><BR>";
                           echo "<A HREF=\"admin.php?action=add&type=eleve\">";
			   echo _("retour");
			   echo "</A></CENTER>";
                          }
                          else 
                          {
                           
                           $requete = "insert into locations (local,biblio,rangee) values ('$local','$biblio','$rangee')";
                           if(!($resultat = biblio_db_query($requete)))
                           { echo "PROBLEME : " .biblio_db_error(); exit;}                           
                           put_log(2,$requete,$user);
                           echo "<CENTER><BR><b>$local --> $biblio --> $rangee</b> ";
			   echo _("est ajout&eacute; &agrave; la base de donn&eacute;es.");
			   echo "<br></center>";
                          }
                        }
                        else
                        {
                          ?>
                                <CENTER><H3>
				<?php echo _("Ajouter un emplacement de livres"); ?>
				</H3>
                                <FORM action=admin.php METHOD=POST>
                                <TABLE BORDER=0>
                                <TR>
                                <TD>
				<?php echo _("Local"); ?>
				:</TD><TD><INPUT TYPE="text" NAME="local" size=20></TD><TR>
                                <TD>
				<?php echo _("Biblio"); ?>
				:</TD><TD><INPUT TYPE="text" NAME="biblio" size=20></TD><TR>
                                <TD>
				<?php echo _("Rang&eacute;e"); ?>
				:</TD><TD><INPUT TYPE="text" NAME="rangee" size=20></TD>
                                </TABLE><BR>
                                <INPUT TYPE="hidden" NAME="user" value="<?php echo $user; ?>">
                                <INPUT TYPE="hidden" NAME="action" value="<?php echo $action; ?>">
                                <INPUT TYPE="hidden" NAME="type" value="<?php echo $type; ?>">
                                <INPUT TYPE="hidden" NAME="sw" value="1">
                                <input type="Submit" value="<?php echo _("Enregistrer"); ?>">
                                </FORM>
                                </CENTER>
                                <?php
                        }
?>              
<br><br>
<div>
<span id=left-text>
<A HREF="admin.php?menu=1">
<?php echo _("retour menu administration"); ?>
</A><BR>
<A HREF="index.php">
<?php echo _("retour menu principal"); ?>
</A></span>
</div>
<br>
Return current item: Open Biblio