UBOOT 源码
源代码在线查看: browse.php
// (C) Copyright 2001 // Murray Jensen // CSIRO Manufacturing Science and Technology, Preston Lab // list page (hymod_bddb / boards) require("defs.php"); $serno=isset($_REQUEST['serno'])?$_REQUEST['serno']:''; $verbose=isset($_REQUEST['verbose'])?intval($_REQUEST['verbose']):0; pg_head("$bddb_label - Browse database" . ($verbose?" (verbose)":"")); ?> $limit=isset($_REQUEST['limit'])?abs(intval($_REQUEST['limit'])):20; $offset=isset($_REQUEST['offset'])?abs(intval($_REQUEST['offset'])):0; if ($serno == '') { $lr=mysql_query("select count(*) as n from boards"); $lrow=mysql_fetch_array($lr); if($lrow['n']>$limit){ $preoffset=max(0,$offset-$limit); $postoffset=$offset+$limit; echo "\n\n"; printf("\n", $offset>0?"":"no", $PHP_SELF, $preoffset, $verbose); printf("\n", $postoffset echo "\n\n"; } mysql_free_result($lr); } ?> serno / edit ethaddr date batch type rev location if ($verbose) { echo "comments\n"; echo "sdram\n"; echo "flash\n"; echo "zbt\n"; echo "xlxtyp\n"; echo "xlxspd\n"; echo "xlxtmp\n"; echo "xlxgrd\n"; echo "cputyp\n"; echo "cpuspd\n"; echo "cpmspd\n"; echo "busspd\n"; echo "hstype\n"; echo "hschin\n"; echo "hschout\n"; } ?> $query = "select * from boards"; if ($serno != '') { $pre = " where "; foreach (preg_split("/[\s,]+/", $serno) as $s) { if (preg_match('/^[0-9]+$/',$s)) $query .= $pre . "serno=" . $s; else if (preg_match('/^([0-9]+)-([0-9]+)$/',$s,$m)) { $m1 = intval($m[1]); $m2 = intval($m[2]); if ($m2 die("bad serial number range ($s)"); $query .= $pre . "(serno>=$m[1] and serno } else die("illegal serial number ($s)"); $pre = " or "; } } $query .= " order by serno"; if ($serno == '') $query .= " limit $offset,$limit"; $r = mysql_query($query); function print_cell($str) { if ($str == '') $str = ' '; echo "\t$str\n"; } while($row=mysql_fetch_array($r)){ foreach ($columns as $key) { if (!key_in_array($key, $row)) $row[$key] = ''; } echo "\n"; print_cell("Log"); print_cell("$row[serno]"); print_cell($row['ethaddr']); print_cell($row['date']); print_cell($row['batch']); print_cell($row['type']); print_cell($row['rev']); print_cell($row['location']); if ($verbose) { print_cell("\n" . urldecode($row['comments']) . "\n\t"); print_cell(gather_enum_multi_print("sdram", 4, $row)); print_cell(gather_enum_multi_print("flash", 4, $row)); print_cell(gather_enum_multi_print("zbt", 16, $row)); print_cell(gather_enum_multi_print("xlxtyp", 4, $row)); print_cell(gather_enum_multi_print("xlxspd", 4, $row)); print_cell(gather_enum_multi_print("xlxtmp", 4, $row)); print_cell(gather_enum_multi_print("xlxgrd", 4, $row)); print_cell($row['cputyp']); print_cell($row['cpuspd']); print_cell($row['cpmspd']); print_cell($row['busspd']); print_cell($row['hstype']); print_cell($row['hschin']); print_cell($row['hschout']); } echo "\n"; } ?> printf("%s Listing\n", $PHP_SELF, $offset, $verbose?0:1, $serno!=''?"&serno=$serno":'', $verbose?"Terse":"Verbose"); ?> Back to Start pg_foot(); ?>