doedlog.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 - Edit Log Entry Results");
  9. if (!isset($_REQUEST['serno']) || $_REQUEST['serno'] == '')
  10. die("the board serial number was not specified");
  11. $serno=intval($_REQUEST['serno']);
  12. if (!isset($_REQUEST['logno']) || $_REQUEST['logno'] == '')
  13. die("log number not specified!");
  14. $logno=intval($_REQUEST['logno']);
  15. $query="update log set";
  16. if (isset($_REQUEST['date'])) {
  17. $date=$_REQUEST['date'];
  18. list($y, $m, $d) = split("-", $date);
  19. if (!checkdate($m, $d, $y) || $y < 1999)
  20. die("date is invalid (input '$date', " .
  21. "yyyy-mm-dd '$y-$m-$d')");
  22. $query.=" date='$date'";
  23. }
  24. if (isset($_REQUEST['who'])) {
  25. $who=$_REQUEST['who'];
  26. $query.=", who='" . $who . "'";
  27. }
  28. if (isset($_REQUEST['details'])) {
  29. $details=$_REQUEST['details'];
  30. $query.=", details='" . rawurlencode($details) . "'";
  31. }
  32. $query.=" where serno=$serno and logno=$logno";
  33. mysql_query($query);
  34. if(mysql_errno()) {
  35. $errstr = mysql_error();
  36. echo "\t<font size=+4>\n";
  37. echo "\t\t<p>\n";
  38. echo "\t\t\tThe following error was encountered:\n";
  39. echo "\t\t</p>\n";
  40. echo "\t\t<center>\n";
  41. printf("\t\t\t<b>%s</b>\n", $errstr);
  42. echo "\t\t</center>\n";
  43. echo "\t</font>\n";
  44. }
  45. else {
  46. echo "\t<font size=+2>\n";
  47. echo "\t\t<p>\n";
  48. echo "\t\t\tThe log entry with log number <b>$logno</b> and\n";
  49. echo "\t\t\tserial number <b>$serno</b> ";
  50. echo "was successfully updated\n";
  51. echo "\t\t</p>\n";
  52. echo "\t</font>\n";
  53. }
  54. ?>
  55. <p>
  56. <table align=center width="100%">
  57. <tr>
  58. <td align=center><a href="brlog.php?serno=<?php echo "$serno"; ?>">Back to Log</a></td>
  59. <td align=center><a href="index.php">Back to Start</a></td>
  60. </tr>
  61. </table>
  62. <?php
  63. pg_foot();
  64. ?>