<?php /** * Input new box, rack or fridge for stock * <br/><br/> * Access to all user except of guests * @author Gabriele Droege, DNA Bank Network <contact@dnabank-network.org> * @version 2.0 * @package Input * @copyright Copyright © 2011 DNA Bank Network http://www.dnabank-network.org<br>The contents of this file are subject to the Mozilla Public License Version 1.1 * @filesource * @license http://www.mozilla.org/MPL/ MPL */ /** * calling connection to database */ include ("../config/head.php"); /** * calling authorisation script */ include ("../auth.php"); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>DNA Module - Add new Stock Location</title> <link rel="stylesheet" type="text/css" href="../format.css"> <link rel="stylesheet" type="text/css" href="XSLT/Styles.css"> <SCRIPT LANGUAGE="JavaScript1.1" src="../Functions.js"></SCRIPT> <NOSCRIPT>Please enable Javascript!</NOSCRIPT> </head> <body> <div align="center"> <?php /** * including navigation menu */ include("../tablenavi.php"); ?> <form name="formular" method="POST" action="new_stock.php"> <table id="tablemain" class="main"> <tr> <td id="tdLogo"><a href="<?php echo $Path_Wiki."/Input_DNA_Data"; ?>" target="_blank"><img border="0" src="../images/Logo-Wiki.png" height="78"></a></td> <td> <h1>DNA Bank Network - Location Stock Administration</h1></td> <td id="tdLogo2"><?php echo $Path_Logo; ?></td> </tr> <tr> <td colspan="3"><?php echo "Logged in as: "; $log = $_SESSION["log"]; echo $log; ?></td> </tr> <tr> <td valign="top" align="center" valign="middle" colspan="3"> <table id="table" width="70%" border="0" style="margin:30 0 0 0"> <tr> <td align="center" width="50%" valign="top"> <?php if (isset($_SESSION['guest']) || $_SESSION['guest']) { /******************************************************************************************** * Guests don't have permission for entering new DNA data * *********************************************************************************************/ echo "<tr><td colspan='3'><span class='error'>Sorry, as a guest you don't have permission for entering new data! If you want to search for existing DNA data please use the Search function!</span></td></tr>"; } else { if($formSubmitSaveBox) { if(empty($formNewBox)) { unset($formNewBox); } else { $result= mysqli_query($GLOBALS["___mysqli_ston"], "SELECT ID_Stock_Box, Stock_Box FROM stock_box " . "WHERE Stock_Box = '$formNewBox'"); if(mysqli_num_rows($result)) { echo "<p id='DescriptionRed'>Entry exists already!"; } else { $result = "INSERT INTO stock_box (Stock_Box, Created_Who)" . "VALUES ('$formNewBox','$log')"; $sql = mysqli_query($GLOBALS["___mysqli_ston"], $result); #######################################Error 1############################################################### if(!$sql) { $msg = $result."\n"; $msg .= "####Error 1####"; if($debug == '1') echo $msg; trigger_error($msg, E_USER_ERROR); /** * calling Error message */ include ("Errorreport.php"); } ############################################################################################################# else { include("../config/ChangesAccepted.php"); } } } }//if ($formSubmitSaveBox) if($formSubmitSaveRack) { if(empty($formNewRack)) { unset($formNewRack); } else { $result= mysqli_query($GLOBALS["___mysqli_ston"], "SELECT ID_Stock_Rack, Stock_Rack FROM stock_rack " . "WHERE Stock_Rack = '$formNewRack'"); if(mysqli_num_rows($result)) { echo "<p id='DescriptionRed'>Entry exists already!"; } else { $result = "INSERT INTO stock_rack (Stock_Rack, Created_Who)" . "VALUES ('$formNewRack','$log')"; $sql = mysqli_query($GLOBALS["___mysqli_ston"], $result); #######################################Error 2############################################################### if(!$sql) { $msg = $result."\n"; $msg .= "####Error 2####"; if($debug == '1') echo $msg; trigger_error($msg, E_USER_ERROR); /** * calling Error message */ include ("Errorreport.php"); } ############################################################################################################# else { echo "<span class='fine'>Changes accepted!</span>"; } } } }//if ($formSubmitSaveRack) if($formSubmitSaveFridge) { if(empty($formNewFridge)) { unset($formNewFridge); } else { $result= mysqli_query($GLOBALS["___mysqli_ston"], "SELECT ID_Stock_Fridge, Stock_Fridge FROM stock_fridge " . "WHERE Stock_Fridge = '$formNewFridge'"); if(mysqli_num_rows($result)) { echo "<p id='DescriptionRed'>Entry exists already!"; } else { $result = "INSERT INTO stock_fridge (Stock_Fridge, Created_Who)" . "VALUES ('$formNewFridge','$log')"; $sql = mysqli_query($GLOBALS["___mysqli_ston"], $result); #######################################Error 3############################################################### if(!$sql) { $msg = $result."\n"; $msg .= "####Error 3####"; if($debug == '1') echo $msg; trigger_error($msg, E_USER_ERROR); /** * calling Error message */ include ("Errorreport.php"); } ############################################################################################################# else { echo "<span class='fine'>Changes accepted!</span>"; } } } }//if ($formSubmitSaveFridge) } ?> <table border="0" style="margin:0 0 0 0"> <?php $result= mysqli_query($GLOBALS["___mysqli_ston"], "SELECT Stock_Box FROM stock_box " . "ORDER BY Stock_Box"); $num_rows = mysqli_num_rows($result); $num_fields = (($___mysqli_tmp = mysqli_num_fields($result)) ? $___mysqli_tmp : false); for ($i=0; $i<$num_fields; $i++) echo"<th>".htmlentities(((($___mysqli_tmp = mysqli_fetch_field_direct($result, 0)->name) && (!is_null($___mysqli_tmp))) ? $___mysqli_tmp : false))."</th>"; while ($row = mysqli_fetch_row($result)) { echo "<tr>"; for ($j=0; $j<$num_fields; $j++) echo "<td align='left'>".htmlentities($row[$j])." </td>"; echo "</tr>"; } ((mysqli_free_result($result) || (is_object($result) && (get_class($result) == "mysqli_result"))) ? true : false); ?> </table> </td> <td valign="top"> <table border="0" style="margin:0 0 0 0"> <?php $result= mysqli_query($GLOBALS["___mysqli_ston"], "SELECT Stock_Rack FROM stock_rack " . "ORDER BY Stock_Rack"); $num_rows = mysqli_num_rows($result); $num_fields = (($___mysqli_tmp = mysqli_num_fields($result)) ? $___mysqli_tmp : false); for ($i=0; $i<$num_fields; $i++) echo"<th>".htmlentities(((($___mysqli_tmp = mysqli_fetch_field_direct($result, 0)->name) && (!is_null($___mysqli_tmp))) ? $___mysqli_tmp : false))."</th>"; while ($row = mysqli_fetch_row($result)) { echo "<tr>"; for ($j=0; $j<$num_fields; $j++) echo "<td align='left'>".htmlentities($row[$j])." </td>"; echo "</tr>"; } ((mysqli_free_result($result) || (is_object($result) && (get_class($result) == "mysqli_result"))) ? true : false); ?> </table> </td> <td valign="top"> <table border="0" style="margin:0 0 0 0"> <?php $result= mysqli_query($GLOBALS["___mysqli_ston"], "SELECT Stock_Fridge FROM stock_fridge " . "ORDER BY Stock_Fridge"); $num_rows = mysqli_num_rows($result); $num_fields = (($___mysqli_tmp = mysqli_num_fields($result)) ? $___mysqli_tmp : false); for ($i=0; $i<$num_fields; $i++) echo"<th>".htmlentities(((($___mysqli_tmp = mysqli_fetch_field_direct($result, 0)->name) && (!is_null($___mysqli_tmp))) ? $___mysqli_tmp : false))."</th>"; while ($row = mysqli_fetch_row($result)) { echo "<tr>"; for ($j=0; $j<$num_fields; $j++) echo "<td align='left'>".htmlentities($row[$j])." </td>"; echo "</tr>"; } ((mysqli_free_result($result) || (is_object($result) && (get_class($result) == "mysqli_result"))) ? true : false); ?> </table> </td> </tr> <tr> <td colspan="3"> <table border="0"><tr><td>Add new Box: </td><td><input type="text" name="formNewBox"></td> <td>Add new Rack:</td><td><input type="text" name="formNewRack"></td><td>Add new fridge: </td><td><input type="text" name="formNewFridge"></td> </tr> <tr><td></td><td><input type="submit" id="button" name="formSubmitSaveBox" value="Save New Box" style="float:right"></td><td></td><td><input type="submit" id="button" name="formSubmitSaveRack" value="Save New Rack" style="float:right"></td><td></td><td><input type="submit" id="button" name="formSubmitSaveFridge" value="Save New Fridge" style="float:right"></td></tr></table> </td> </tr> <tr> <td colspan="3"> <br><input type="submit" id="button" name="formSubmitClose" value="Close Form" style="float:right" onclick="window.close();"> </td> </tr> <tr><td colspan="3">Nach Schließen des Formulares müssen Sie die Input- bzw. Suchmaske neu laden, damit die Änderungen aktiv werden.</td></tr> </table> </td> </tr> </table> <?php /** * including footer */ include("../footer.php"); ?> </form> </div> </body> </html>