brlog.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. // list page (hymod_bddb / boards)
  7. require("defs.php");
  8. pg_head("$bddb_label - Browse Board Log");
  9. if (!isset($serno) || $serno == 0)
  10. die("serial number not specified!");
  11. function print_cell($str) {
  12. if ($str == '')
  13. $str = '&nbsp;';
  14. echo "\t<td>$str</td>\n";
  15. }
  16. ?>
  17. <table align=center border=1 cellpadding=10>
  18. <tr>
  19. <th>serno / edit</th>
  20. <th>ethaddr</th>
  21. <th>date</th>
  22. <th>batch</th>
  23. <th>type</th>
  24. <th>rev</th>
  25. <th>location</th>
  26. </tr>
  27. <?php
  28. $r=mysql_query("select * from boards where serno=$serno");
  29. while($row=mysql_fetch_array($r)){
  30. foreach ($columns as $key) {
  31. if (!key_in_array($key, $row))
  32. $row[$key] = '';
  33. }
  34. echo "<tr>\n";
  35. print_cell("<a href=\"edit.php?serno=$row[serno]\">$row[serno]</a>");
  36. print_cell($row['ethaddr']);
  37. print_cell($row['date']);
  38. print_cell($row['batch']);
  39. print_cell($row['type']);
  40. print_cell($row['rev']);
  41. print_cell($row['location']);
  42. echo "</tr>\n";
  43. }
  44. mysql_free_result($r);
  45. ?>
  46. </table>
  47. <hr></hr>
  48. <p></p>
  49. <?php
  50. $limit=abs(isset($limit)?$limit:20);
  51. $offset=abs(isset($offset)?$offset:0);
  52. $lr=mysql_query("select count(*) as n from log where serno=$serno");
  53. $lrow=mysql_fetch_array($lr);
  54. if($lrow['n']>$limit){
  55. $preoffset=max(0,$offset-$limit);
  56. $postoffset=$offset+$limit;
  57. echo "<table width=\"100%\">\n<tr align=center>\n";
  58. printf("<td><%sa href=\"%s?serno=$serno&offset=%d\"><img border=0 alt=\"&lt;\" src=\"/icons/left.gif\"></a></td>\n", $offset>0?"":"no", $PHP_SELF, $preoffset);
  59. printf("<td><%sa href=\"%s?serno=$serno&offset=%d\"><img border=0 alt=\"&gt;\" src=\"/icons/right.gif\"></a></td>\n", $postoffset<$lrow['n']?"":"no", $PHP_SELF, $postoffset);
  60. echo "</tr>\n</table>\n";
  61. }
  62. mysql_free_result($lr);
  63. ?>
  64. <table width="100%" border=1 cellpadding=10>
  65. <tr valign=top>
  66. <th>logno / edit</th>
  67. <th>date</th>
  68. <th>who</th>
  69. <th width="70%">details</th>
  70. </tr>
  71. <?php
  72. $r=mysql_query("select * from log where serno=$serno order by logno limit $offset,$limit");
  73. while($row=mysql_fetch_array($r)){
  74. echo "<tr>\n";
  75. print_cell("<a href=\"edlog.php?serno=$row[serno]&logno=$row[logno]\">$row[logno]</a>");
  76. print_cell($row['date']);
  77. print_cell($row['who']);
  78. print_cell("<pre>" . urldecode($row['details']) . "</pre>");
  79. echo "</tr>\n";
  80. }
  81. mysql_free_result($r);
  82. ?>
  83. </table>
  84. <hr></hr>
  85. <p></p>
  86. <table width="100%">
  87. <tr>
  88. <td align=center>
  89. <a href="newlog.php?serno=<?php echo "$serno"; ?>">Add to Log</a>
  90. </td>
  91. <td align=center>
  92. <a href="index.php">Back to Start</a>
  93. </td>
  94. </tr>
  95. </table>
  96. <?php
  97. pg_foot();
  98. ?>