Source for file new_preservation.php

Documentation is available at new_preservation.php

  1. <?php/**
  2. * Input new preservation method
  3. * <br/><br/>
  4. * Access to all user except of guests
  5. @author Gabriele Droege, DNA Bank Network <contact@dnabank-network.org>
  6. @version 2.0
  7. @package Input
  8. @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
  9. @filesource
  10. @license http://www.mozilla.org/MPL/ MPL
  11. */
  12.  
  13.     /**
  14.     * calling connection to database
  15.     */
  16.     include ("../config/head.php");
  17.  
  18.     /**
  19.     * calling authorisation script
  20.     */
  21.     include ("../auth.php");
  22. ?>
  23. <html>
  24.  
  25. <head>
  26. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  27. <title>DNA Bank Network - Add New Preservation</title>
  28. <link rel="stylesheet" type="text/css" href="../format.css">
  29. <SCRIPT LANGUAGE="JavaScript1.1" src="../Functions.js"></SCRIPT>
  30. <NOSCRIPT>Please enable Javascript!</NOSCRIPT>
  31.  
  32. </head>
  33. <body>
  34. <div align="center">
  35. <?php 
  36. /**
  37.   * including navigation menu
  38.   */
  39. include("../tablenavi.php")?>
  40. <form name="formular" method="POST" action="new_preservation.php"> 
  41. <table id="tablemain" class="main">
  42. <tr>
  43.   <td id="tdLogo"><a href="<?php echo $Path_Wiki."/Features#Input"?>" target="_blank"><img border="0" src="../images/Logo-Wiki.png" height="78"></a></td>
  44.         <td id="tdtitle">
  45.         <h1>Add New Preservation</h1></td>
  46.     <td id="tdLogo2"><?php echo $Path_Logo?></td>
  47.     </tr>
  48.   <tr>
  49.   <td><?php
  50.     echo "Logged in as: ";
  51.     $log $_SESSION["log"];
  52.     echo $log;
  53.  
  54.     ?></td>
  55.   </tr>
  56. <tr>
  57. <td valign="top" align="center" valign="middle" colspan="3">
  58. <table id="table" width="70%" border="0" style="margin:30 0 0 0">
  59. <tr>
  60. <td align="center" colspan="2">
  61. <?php
  62. if (isset($_SESSION['guest']|| $_SESSION['guest']{
  63.     /********************************************************************************************
  64.     * Guests don't have permission for entering new DNA data                                    *
  65.     *********************************************************************************************/
  66. 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>"}
  67.  
  68. else {
  69.  
  70. if($formSubmitSave)
  71. {  
  72.  
  73.   if(empty($formNewPreservation))
  74.     unset($formNewPreservation)}
  75.  
  76.   else 
  77.   {
  78.      $resultmysql_query ("SELECT ID_Preservation, Preservation FROM preservation " .
  79.                             "WHERE Preservation = '$formNewPreservation'");
  80.   
  81.      if(mysql_num_rows($result))
  82.        {  
  83.        echo "<span class='error'>Preservation already exists!</span>";
  84.        }
  85.  
  86.      else    
  87.        {
  88.         $result "INSERT INTO preservation (Preservation, Created_Who)" .
  89.                           "VALUES ('$formNewPreservation','$log')";   
  90.         $sql mysql_query($result);
  91.  
  92. #######################################Error 1###############################################################
  93.  
  94. if(!$sql)
  95. $msg $result."\n";
  96.   $msg .= "####Error 1####";
  97.   trigger_error($msgE_USER_ERROR);
  98.   /**
  99.   * calling Error message
  100.   */
  101.   include ("Errorreport.php");   }
  102.   
  103. #############################################################################################################
  104.  
  105.         else {
  106.         echo "<span class='fine'>Changes accepted!</span>"}                            
  107.        }
  108.    }
  109. }//if ($formSubmitSave)
  110.  
  111. ?>
  112. <table border="1" style="margin:0 0 0 0">
  113.  
  114. <?php
  115.  
  116. $resultmysql_query ("SELECT * FROM preservation " .
  117.                       "ORDER BY Preservation");
  118.       
  119. $num_rows mysql_num_rows($result);
  120.  
  121. if($num_rows 0{
  122.     echo"<th>Preservation</th><th>Created</th>";
  123.  
  124. while ($row mysql_fetch_object($result))
  125. {
  126.     echo "<tr><td align='center'>".$row->Preservation."</td><td>".$row->Created_Who." (".$row->Created_When.")</td></tr>";
  127. }}
  128.  
  129. ?>
  130. </table>
  131. </td></tr>
  132. <tr>
  133. <td id="Change">Add new Preservation:</td><td><input type="text" name="formNewPreservation"></td></tr>
  134. <tr>
  135. <td>
  136. </td>
  137. <td><input type="submit" name="formSubmitSave" value="Save New Preservation" style="float:left">
  138. </td>
  139. </tr>
  140. <tr>
  141. <td colspan="2"><input type="submit" id="button" name="formSubmitClose" value="Close Form" style="float:right" onclick="window.close();"></td>
  142. </tr>
  143. <tr><td colspan="2"><span class="error">Please refresh input/search mask after closing this form.</span></td></tr>
  144.  
  145. <?php ?>
  146.  
  147. </table>
  148. </td>
  149. </tr>
  150. </table>
  151. <?php
  152.     /**
  153.     * including footer
  154.     */
  155.     include("../footer.php")?> 
  156. </form>
  157. </div>
  158. </body>
  159. </html>

Documentation generated on Tue, 29 Nov 2011 10:44:57 +0100 by phpDocumentor 1.4.3