donewlog.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php // php pages made with phpMyBuilder <http://kyber.dk/phpMyBuilder> ?>
  2. <?php
  3. // (C) Copyright 2001
  4. // Murray Jensen <Murray.Jensen@cmst.csiro.au>
  5. // CSIRO Manufacturing Science and Technology, Preston Lab
  6. // doedit page (hymod_bddb / boards)
  7. require("defs.php");
  8. pg_head("$bddb_label - Add Log Entry Results");
  9. if ($serno == 0)
  10. die("serial number not specified!");
  11. if (isset($logno))
  12. die("log number must not be set ($logno) when Creating!");
  13. $query="update log set serno=$serno";
  14. list($y, $m, $d) = split("-", $date);
  15. if (!checkdate($m, $d, $y) || $y < 1999)
  16. die("date is invalid (input '$date', yyyy-mm-dd '$y-$m-$d')");
  17. $query.=", date='$date'";
  18. if (isset($who))
  19. $query.=", who='" . $who . "'";
  20. if (isset($details))
  21. $query.=", details='" . rawurlencode($details) . "'";
  22. // echo "final query = '$query'<br>\n";
  23. $sqlerr = '';
  24. mysql_query("insert into log (logno) values (null)");
  25. if (mysql_errno())
  26. $sqlerr = mysql_error();
  27. else {
  28. $logno = mysql_insert_id();
  29. if (!$logno)
  30. $sqlerr = "couldn't allocate new serial number";
  31. else {
  32. mysql_query($query . " where logno=$logno");
  33. if (mysql_errno())
  34. $sqlerr = mysql_error();
  35. }
  36. }
  37. if ($sqlerr == '') {
  38. echo "<font size=+2>\n";
  39. echo "\t<p>\n";
  40. echo "\t\tA log entry with log number '$logno' was " .
  41. "added to the board with serial number '$serno'\n";
  42. echo "\t</p>\n";
  43. echo "</font>\n";
  44. }
  45. else {
  46. echo "\t<font size=+4>\n";
  47. echo "\t\t<p>\n";
  48. echo "\t\t\tThe following SQL error was encountered:\n";
  49. echo "\t\t</p>\n";
  50. echo "\t\t<center>\n";
  51. printf("\t\t\t<b>%s</b>\n", $sqlerr);
  52. echo "\t\t</center>\n";
  53. echo "\t</font>\n";
  54. }
  55. ?>
  56. <p></p>
  57. <table width="100%">
  58. <tr>
  59. <td align=center><a href="brlog.php?serno=<?php echo "$serno"; ?>">Go to Browse</a></td>
  60. <td align=center><a href="index.php">Back to Start</a></td>
  61. </tr>
  62. </table>
  63. <?php
  64. pg_foot();
  65. ?>