donewlog.php 2.1 KB

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