browse.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. if (!isset($verbose))
  9. $verbose = 0;
  10. if (!isset($serno))
  11. $serno = 0;
  12. pg_head("$bddb_label - Browse database" . ($verbose?" (verbose)":""));
  13. ?>
  14. <p></p>
  15. <?php
  16. if ($serno == 0) {
  17. $limit=abs(isset($limit)?$limit:20);
  18. $offset=abs(isset($offset)?$offset:0);
  19. $lr=mysql_query("select count(*) as n from boards");
  20. $lrow=mysql_fetch_array($lr);
  21. if($lrow['n']>$limit){
  22. $preoffset=max(0,$offset-$limit);
  23. $postoffset=$offset+$limit;
  24. echo "<table width=\"100%\">\n<tr align=center>\n";
  25. printf("<td><%sa href=\"%s?offset=%d\"><img border=0 alt=\"&lt;\" src=\"/icons/left.gif\"></a></td>\n", $offset>0?"":"no", $PHP_SELF, $preoffset);
  26. printf("<td><%sa href=\"%s?offset=%d\"><img border=0 alt=\"&gt;\" src=\"/icons/right.gif\"></a></td>\n", $postoffset<$lrow['n']?"":"no", $PHP_SELF, $postoffset);
  27. echo "</tr>\n</table>\n";
  28. }
  29. mysql_free_result($lr);
  30. }
  31. ?>
  32. <table align=center border=1 cellpadding=10>
  33. <tr>
  34. <th></th>
  35. <th>serno / edit</th>
  36. <th>ethaddr</th>
  37. <th>date</th>
  38. <th>batch</th>
  39. <th>type</th>
  40. <th>rev</th>
  41. <th>location</th>
  42. <?php
  43. if ($verbose) {
  44. echo "<th>comments</th>\n";
  45. echo "<th>sdram</th>\n";
  46. echo "<th>flash</th>\n";
  47. echo "<th>zbt</th>\n";
  48. echo "<th>xlxtyp</th>\n";
  49. echo "<th>xlxspd</th>\n";
  50. echo "<th>xlxtmp</th>\n";
  51. echo "<th>xlxgrd</th>\n";
  52. echo "<th>cputyp</th>\n";
  53. echo "<th>cpuspd</th>\n";
  54. echo "<th>cpmspd</th>\n";
  55. echo "<th>busspd</th>\n";
  56. echo "<th>hstype</th>\n";
  57. echo "<th>hschin</th>\n";
  58. echo "<th>hschout</th>\n";
  59. }
  60. ?>
  61. </tr>
  62. <?php
  63. if ($serno == 0)
  64. $r=mysql_query("select * from boards order by serno limit $offset,$limit");
  65. else
  66. $r=mysql_query("select * from boards where serno=$serno");
  67. function print_cell($str) {
  68. if ($str == '')
  69. $str = '&nbsp;';
  70. echo "\t<td>$str</td>\n";
  71. }
  72. while($row=mysql_fetch_array($r)){
  73. foreach ($columns as $key) {
  74. if (!key_in_array($key, $row))
  75. $row[$key] = '';
  76. }
  77. echo "<tr>\n";
  78. print_cell("<a href=\"brlog.php?serno=$row[serno]\">Log</a>");
  79. print_cell("<a href=\"edit.php?serno=$row[serno]\">$row[serno]</a>");
  80. print_cell($row['ethaddr']);
  81. print_cell($row['date']);
  82. print_cell($row['batch']);
  83. print_cell($row['type']);
  84. print_cell($row['rev']);
  85. print_cell($row['location']);
  86. if ($verbose) {
  87. print_cell("<pre>\n" . urldecode($row['comments']) .
  88. "\n\t</pre>");
  89. print_cell(gather_enum_multi_print("sdram", 4, $row));
  90. print_cell(gather_enum_multi_print("flash", 4, $row));
  91. print_cell(gather_enum_multi_print("zbt", 16, $row));
  92. print_cell(gather_enum_multi_print("xlxtyp", 4, $row));
  93. print_cell(gather_enum_multi_print("xlxspd", 4, $row));
  94. print_cell(gather_enum_multi_print("xlxtmp", 4, $row));
  95. print_cell(gather_enum_multi_print("xlxgrd", 4, $row));
  96. print_cell($row['cputyp']);
  97. print_cell($row['cpuspd']);
  98. print_cell($row['cpmspd']);
  99. print_cell($row['busspd']);
  100. print_cell($row['hstype']);
  101. print_cell($row['hschin']);
  102. print_cell($row['hschout']);
  103. }
  104. echo "</tr>\n";
  105. }
  106. ?>
  107. </table>
  108. <p></p>
  109. <table width="100%">
  110. <tr>
  111. <td align=center><?php
  112. if ($verbose)
  113. echo "<a href=\"browse.php?verbose=0\">Terse Listing</a>";
  114. else
  115. echo "<a href=\"browse.php?verbose=1\">Verbose Listing</a>";
  116. ?></td>
  117. <td align=center><a href="index.php">Back to Start</a></td>
  118. </tr>
  119. </table>
  120. <?php
  121. pg_foot();
  122. ?>