brlog.php 2.8 KB

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