Update Hymod Board Database PHP code in "tools" directory

Patch by Murray Jensen, 01 Jul 2005
This commit is contained in:
Wolfgang Denk 2005-08-12 23:27:18 +02:00
parent f9d77ed380
commit d992daf99d
16 changed files with 251 additions and 154 deletions

View File

@ -2,6 +2,9 @@
Changes for U-Boot 1.1.3: Changes for U-Boot 1.1.3:
====================================================================== ======================================================================
* Update Hymod Board Database PHP code in "tools" directory
Patch by Murray Jensen, 01 Jul 2005
* Make "tr" command use POSIX compliant; export HOSTOS make variable * Make "tr" command use POSIX compliant; export HOSTOS make variable
Patch by Murray Jensen, 30 Jun 2005 Patch by Murray Jensen, 30 Jun 2005

View File

@ -10,8 +10,9 @@
pg_head("$bddb_label - Browse Board Log"); pg_head("$bddb_label - Browse Board Log");
if (!isset($serno) || $serno == 0) $serno=intval($serno);
die("serial number not specified!"); if ($serno == 0)
die("serial number not specified or invalid!");
function print_cell($str) { function print_cell($str) {
if ($str == '') if ($str == '')
@ -55,16 +56,16 @@
<hr></hr> <hr></hr>
<p></p> <p></p>
<?php <?php
$limit=abs(isset($limit)?$limit:20); $limit=abs(isset($_REQUEST['limit'])?$_REQUEST['limit']:20);
$offset=abs(isset($offset)?$offset:0); $offset=abs(isset($_REQUEST['offset'])?$_REQUEST['offset']:0);
$lr=mysql_query("select count(*) as n from log where serno=$serno"); $lr=mysql_query("select count(*) as n from log where serno=$serno");
$lrow=mysql_fetch_array($lr); $lrow=mysql_fetch_array($lr);
if($lrow['n']>$limit){ if($lrow['n']>$limit){
$preoffset=max(0,$offset-$limit); $preoffset=max(0,$offset-$limit);
$postoffset=$offset+$limit; $postoffset=$offset+$limit;
echo "<table width=\"100%\">\n<tr align=center>\n"; echo "<table width=\"100%\">\n<tr align=center>\n";
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); 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);
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); 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);
echo "</tr>\n</table>\n"; echo "</tr>\n</table>\n";
} }
mysql_free_result($lr); mysql_free_result($lr);

View File

@ -8,29 +8,31 @@
require("defs.php"); require("defs.php");
if (!isset($verbose)) $serno=isset($_REQUEST['serno'])?$_REQUEST['serno']:'';
$verbose = 0;
if (!isset($serno)) $verbose=isset($_REQUEST['verbose'])?intval($_REQUEST['verbose']):0;
$serno = 0;
pg_head("$bddb_label - Browse database" . ($verbose?" (verbose)":"")); pg_head("$bddb_label - Browse database" . ($verbose?" (verbose)":""));
?> ?>
<p></p> <p></p>
<?php <?php
if ($serno == 0) { $limit=isset($_REQUEST['limit'])?abs(intval($_REQUEST['limit'])):20;
$limit=abs(isset($limit)?$limit:20); $offset=isset($_REQUEST['offset'])?abs(intval($_REQUEST['offset'])):0;
$offset=abs(isset($offset)?$offset:0);
if ($serno == '') {
$lr=mysql_query("select count(*) as n from boards"); $lr=mysql_query("select count(*) as n from boards");
$lrow=mysql_fetch_array($lr); $lrow=mysql_fetch_array($lr);
if($lrow['n']>$limit){ if($lrow['n']>$limit){
$preoffset=max(0,$offset-$limit); $preoffset=max(0,$offset-$limit);
$postoffset=$offset+$limit; $postoffset=$offset+$limit;
echo "<table width=\"100%\">\n<tr align=center>\n"; echo "<table width=\"100%\">\n<tr>\n";
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); printf("<td align=left><%sa href=\"%s?submit=Browse&offset=%d&verbose=%d\"><img border=0 alt=\"&lt;\" src=\"/icons/left.gif\"></a></td>\n", $offset>0?"":"no", $PHP_SELF, $preoffset, $verbose);
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); printf("<td align=right><%sa href=\"%s?submit=Browse&offset=%d&verbose=%d\"><img border=0 alt=\"&gt;\" src=\"/icons/right.gif\"></a></td>\n", $postoffset<$lrow['n']?"":"no", $PHP_SELF, $postoffset, $offset);
echo "</tr>\n</table>\n"; echo "</tr>\n</table>\n";
} }
mysql_free_result($lr); mysql_free_result($lr);
} }
?> ?>
@ -65,10 +67,28 @@
?> ?>
</tr> </tr>
<?php <?php
if ($serno == 0) $query = "select * from boards";
$r=mysql_query("select * from boards order by serno limit $offset,$limit"); 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 <= $m1)
die("bad serial number range ($s)");
$query .= $pre . "(serno>=$m[1] and serno<=$m[2])";
}
else else
$r=mysql_query("select * from boards where serno=$serno"); 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) { function print_cell($str) {
if ($str == '') if ($str == '')
@ -117,10 +137,7 @@
<table width="100%"> <table width="100%">
<tr> <tr>
<td align=center><?php <td align=center><?php
if ($verbose) printf("<a href=\"%s?submit=Browse&offset=%d&verbose=%d%s\">%s Listing</a>\n", $PHP_SELF, $offset, $verbose?0:1, $serno!=''?"&serno=$serno":'', $verbose?"Terse":"Verbose");
echo "<a href=\"browse.php?verbose=0\">Terse Listing</a>";
else
echo "<a href=\"browse.php?verbose=1\">Verbose Listing</a>";
?></td> ?></td>
<td align=center><a href="index.php">Back to Start</a></td> <td align=center><a href="index.php">Back to Start</a></td>
</tr> </tr>

View File

@ -22,38 +22,38 @@ CREATE TABLE boards (
rev tinyint(3) unsigned zerofill NOT NULL, rev tinyint(3) unsigned zerofill NOT NULL,
location char(64), location char(64),
comments text, comments text,
sdram0 enum('32M','64M','128M','256M'), sdram0 enum('32M','64M','128M','256M','512M','1G','2G','4G'),
sdram1 enum('32M','64M','128M','256M'), sdram1 enum('32M','64M','128M','256M','512M','1G','2G','4G'),
sdram2 enum('32M','64M','128M','256M'), sdram2 enum('32M','64M','128M','256M','512M','1G','2G','4G'),
sdram3 enum('32M','64M','128M','256M'), sdram3 enum('32M','64M','128M','256M','512M','1G','2G','4G'),
flash0 enum('4M','8M','16M','32M','64M'), flash0 enum('4M','8M','16M','32M','64M','128M','256M','512M','1G'),
flash1 enum('4M','8M','16M','32M','64M'), flash1 enum('4M','8M','16M','32M','64M','128M','256M','512M','1G'),
flash2 enum('4M','8M','16M','32M','64M'), flash2 enum('4M','8M','16M','32M','64M','128M','256M','512M','1G'),
flash3 enum('4M','8M','16M','32M','64M'), flash3 enum('4M','8M','16M','32M','64M','128M','256M','512M','1G'),
zbt0 enum('512K','1M','2M','4M'), zbt0 enum('512K','1M','2M','4M','8M','16M'),
zbt1 enum('512K','1M','2M','4M'), zbt1 enum('512K','1M','2M','4M','8M','16M'),
zbt2 enum('512K','1M','2M','4M'), zbt2 enum('512K','1M','2M','4M','8M','16M'),
zbt3 enum('512K','1M','2M','4M'), zbt3 enum('512K','1M','2M','4M','8M','16M'),
zbt4 enum('512K','1M','2M','4M'), zbt4 enum('512K','1M','2M','4M','8M','16M'),
zbt5 enum('512K','1M','2M','4M'), zbt5 enum('512K','1M','2M','4M','8M','16M'),
zbt6 enum('512K','1M','2M','4M'), zbt6 enum('512K','1M','2M','4M','8M','16M'),
zbt7 enum('512K','1M','2M','4M'), zbt7 enum('512K','1M','2M','4M','8M','16M'),
zbt8 enum('512K','1M','2M','4M'), zbt8 enum('512K','1M','2M','4M','8M','16M'),
zbt9 enum('512K','1M','2M','4M'), zbt9 enum('512K','1M','2M','4M','8M','16M'),
zbta enum('512K','1M','2M','4M'), zbta enum('512K','1M','2M','4M','8M','16M'),
zbtb enum('512K','1M','2M','4M'), zbtb enum('512K','1M','2M','4M','8M','16M'),
zbtc enum('512K','1M','2M','4M'), zbtc enum('512K','1M','2M','4M','8M','16M'),
zbtd enum('512K','1M','2M','4M'), zbtd enum('512K','1M','2M','4M','8M','16M'),
zbte enum('512K','1M','2M','4M'), zbte enum('512K','1M','2M','4M','8M','16M'),
zbtf enum('512K','1M','2M','4M'), zbtf enum('512K','1M','2M','4M','8M','16M'),
xlxtyp0 enum('XCV300E','XCV400E','XCV600E'), xlxtyp0 enum('XCV300E','XCV400E','XCV600E','XC2V2000','XC2V3000','XC2V4000','XC2V6000','XC2VP2','XC2VP4','XC2VP7','XC2VP20','XC2VP30','XC2VP50','XC4VFX20','XC4VFX40','XC4VFX60','XC4VFX100','XC4VFX140'),
xlxtyp1 enum('XCV300E','XCV400E','XCV600E'), xlxtyp1 enum('XCV300E','XCV400E','XCV600E','XC2V2000','XC2V3000','XC2V4000','XC2V6000','XC2VP2','XC2VP4','XC2VP7','XC2VP20','XC2VP30','XC2VP50','XC4VFX20','XC4VFX40','XC4VFX60','XC4VFX100','XC4VFX140'),
xlxtyp2 enum('XCV300E','XCV400E','XCV600E'), xlxtyp2 enum('XCV300E','XCV400E','XCV600E','XC2V2000','XC2V3000','XC2V4000','XC2V6000','XC2VP2','XC2VP4','XC2VP7','XC2VP20','XC2VP30','XC2VP50','XC4VFX20','XC4VFX40','XC4VFX60','XC4VFX100','XC4VFX140'),
xlxtyp3 enum('XCV300E','XCV400E','XCV600E'), xlxtyp3 enum('XCV300E','XCV400E','XCV600E','XC2V2000','XC2V3000','XC2V4000','XC2V6000','XC2VP2','XC2VP4','XC2VP7','XC2VP20','XC2VP30','XC2VP50','XC4VFX20','XC4VFX40','XC4VFX60','XC4VFX100','XC4VFX140'),
xlxspd0 enum('6','7','8'), xlxspd0 enum('6','7','8','4','5','9','10','11','12'),
xlxspd1 enum('6','7','8'), xlxspd1 enum('6','7','8','4','5','9','10','11','12'),
xlxspd2 enum('6','7','8'), xlxspd2 enum('6','7','8','4','5','9','10','11','12'),
xlxspd3 enum('6','7','8'), xlxspd3 enum('6','7','8','4','5','9','10','11','12'),
xlxtmp0 enum('COM','IND'), xlxtmp0 enum('COM','IND'),
xlxtmp1 enum('COM','IND'), xlxtmp1 enum('COM','IND'),
xlxtmp2 enum('COM','IND'), xlxtmp2 enum('COM','IND'),
@ -62,13 +62,13 @@ CREATE TABLE boards (
xlxgrd1 enum('NORMAL','ENGSAMP'), xlxgrd1 enum('NORMAL','ENGSAMP'),
xlxgrd2 enum('NORMAL','ENGSAMP'), xlxgrd2 enum('NORMAL','ENGSAMP'),
xlxgrd3 enum('NORMAL','ENGSAMP'), xlxgrd3 enum('NORMAL','ENGSAMP'),
cputyp enum('MPC8260'), cputyp enum('MPC8260(HIP3)','MPC8260A(HIP4)','MPC8280(HIP7)','MPC8560'),
cpuspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ'), cpuspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ','300MHZ','333MHZ','366MHZ','400MHZ','433MHZ','466MHZ','500MHZ','533MHZ','566MHZ','600MHZ','633MHZ','666MHZ','700MHZ','733MHZ','766MHZ','800MHZ','833MHZ','866MHZ','900MHZ','933MHZ','966MHZ','1000MHZ','1033MHZ','1066MHZ','1100MHZ','1133MHZ','1166MHZ','1200MHZ','1233MHZ','1266MHZ','1300MHZ','1333MHZ'),
cpmspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ'), cpmspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ','300MHZ','333MHZ','366MHZ','400MHZ','433MHZ','466MHZ','500MHZ','533MHZ','566MHZ','600MHZ','633MHZ','666MHZ','700MHZ','733MHZ','766MHZ','800MHZ','833MHZ','866MHZ','900MHZ','933MHZ','966MHZ','1000MHZ','1033MHZ','1066MHZ','1100MHZ','1133MHZ','1166MHZ','1200MHZ','1233MHZ','1266MHZ','1300MHZ','1333MHZ'),
busspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ'), busspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ','300MHZ','333MHZ','366MHZ','400MHZ','433MHZ','466MHZ','500MHZ','533MHZ','566MHZ','600MHZ','633MHZ','666MHZ','700MHZ','733MHZ','766MHZ','800MHZ','833MHZ','866MHZ','900MHZ','933MHZ','966MHZ','1000MHZ','1033MHZ','1066MHZ','1100MHZ','1133MHZ','1166MHZ','1200MHZ','1233MHZ','1266MHZ','1300MHZ','1333MHZ'),
hstype enum('AMCC-S2064A'), hstype enum('AMCC-S2064A','Xilinx-Rockets'),
hschin enum('0','1','2','3','4'), hschin enum('0','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16'),
hschout enum('0','1','2','3','4'), hschout enum('0','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16'),
PRIMARY KEY (serno), PRIMARY KEY (serno),
KEY serno (serno), KEY serno (serno),
UNIQUE serno_2 (serno) UNIQUE serno_2 (serno)

View File

@ -7,7 +7,7 @@
// contains mysql user id and password - keep secret // contains mysql user id and password - keep secret
require("config.php"); require("config.php");
if (isset($logout)) { if (isset($_REQUEST['logout'])) {
Header("status: 401 Unauthorized"); Header("status: 401 Unauthorized");
Header("HTTP/1.0 401 Unauthorized"); Header("HTTP/1.0 401 Unauthorized");
Header("WWW-authenticate: basic realm=\"$bddb_label\""); Header("WWW-authenticate: basic realm=\"$bddb_label\"");
@ -45,32 +45,40 @@
// board type // board type
$type_vals = array('IO','CLP','DSP','INPUT','ALT-INPUT','DISPLAY'); $type_vals = array('IO','CLP','DSP','INPUT','ALT-INPUT','DISPLAY');
// sdram sizes (nbits array is for write into eeprom config file) // Xilinx fpga types
$sdram_vals = array('','32M','64M','128M','256M'); $xlxtyp_vals = array('','XCV300E','XCV400E','XCV600E','XC2V2000','XC2V3000','XC2V4000','XC2V6000','XC2VP2','XC2VP4','XC2VP7','XC2VP20','XC2VP30','XC2VP50','XC4VFX20','XC4VFX40','XC4VFX60','XC4VFX100','XC4VFX140');
$sdram_nbits = array(0,25,26,27,28);
// flash sizes (nbits array is for write into eeprom config file) // Xilinx fpga speeds
$flash_vals = array('','4M','8M','16M','32M','64M'); $xlxspd_vals = array('','6','7','8','4','5','9','10','11','12');
$flash_nbits = array(0,22,23,24,25,26);
// zbt ram sizes (nbits array is for write into eeprom config file) // Xilinx fpga temperatures (commercial or industrial)
$zbt_vals = array('','512K','1M','2M','4M');
$zbt_nbits = array(0,19,20,21,22);
// Xilinx attributes
$xlxtyp_vals = array('','XCV300E','XCV400E','XCV600E','XC2V2000','XC2V3000','XC2V4000','XC2V6000');
$xlxspd_vals = array('','6','7','8','4','5');
$xlxtmp_vals = array('','COM','IND'); $xlxtmp_vals = array('','COM','IND');
// Xilinx fpga grades (normal or engineering sample)
$xlxgrd_vals = array('','NORMAL','ENGSAMP'); $xlxgrd_vals = array('','NORMAL','ENGSAMP');
// processor attributes // CPU types
$cputyp_vals = array('','MPC8260'); $cputyp_vals = array('','MPC8260(HIP3)','MPC8260A(HIP4)','MPC8280(HIP7)','MPC8560');
$clk_vals = array('','33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ');
// CPU/BUS/CPM clock speeds
$clk_vals = array('','33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ','300MHZ','333MHZ','366MHZ','400MHZ','433MHZ','466MHZ','500MHZ','533MHZ','566MHZ','600MHZ','633MHZ','666MHZ','700MHZ','733MHZ','766MHZ','800MHZ','833MHZ','866MHZ','900MHZ','933MHZ','966MHZ','1000MHZ','1033MHZ','1066MHZ','1100MHZ','1133MHZ','1166MHZ','1200MHZ','1233MHZ','1266MHZ','1300MHZ','1333MHZ');
// sdram sizes (nbits array is for eeprom config file)
$sdram_vals = array('','32M','64M','128M','256M','512M','1G','2G','4G');
$sdram_nbits = array(0,25,26,27,28,29,30,31,32);
// flash sizes (nbits array is for eeprom config file)
$flash_vals = array('','4M','8M','16M','32M','64M','128M','256M','512M','1G');
$flash_nbits = array(0,22,23,24,25,26,27,28,29,30);
// zbt ram sizes (nbits array is for write into eeprom config file)
$zbt_vals = array('','512K','1M','2M','4M','8M','16M');
$zbt_nbits = array(0,19,20,21,22,23,24);
// high-speed serial attributes // high-speed serial attributes
$hstype_vals = array('','AMCC-S2064A'); $hstype_vals = array('','AMCC-S2064A','Xilinx-Rockets');
$hschin_vals = array('0','1','2','3','4'); $hschin_vals = array('0','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16');
$hschout_vals = array('0','1','2','3','4'); $hschout_vals = array('0','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16');
// value filters - used when outputting html // value filters - used when outputting html
function rev_filter($num) { function rev_filter($num) {
@ -310,6 +318,38 @@
end_field(); end_field();
} }
// print a mysql ENUM as an html SELECT INPUT
function print_enum_select($name, $array, $vals, $def = -1) {
begin_field($name);
echo "\t\t<select name=$name>\n";
if (key_in_array($name, $array))
$chk = array_search($array[$name], $vals, FALSE);
else
$chk = $def;
$nval = count($vals);
for ($i = 0; $i < $nval; $i++) {
$val = $vals[$i];
if ($val == '')
$pval = "none";
else
$pval = "$val";
printf("\t\t\t<option " .
"value=\"%s\"%s>%s</option>\n",
$val, $i == $chk ? " selected" : "", $pval);
}
echo "\t\t</select>\n";
end_field();
}
// print a group of mysql ENUMs (e.g. name0,name1,...) as an html SELECT // print a group of mysql ENUMs (e.g. name0,name1,...) as an html SELECT
function print_enum_multi($base, $array, $vals, $cnt, $defs, $grp = 0) { function print_enum_multi($base, $array, $vals, $cnt, $defs, $grp = 0) {
@ -375,9 +415,9 @@
$name = sprintf("%s%x", $base, $i); $name = sprintf("%s%x", $base, $i);
if (isset($GLOBALS[$name])) { if (isset($_REQUEST[$name])) {
$retval .= sprintf(", %s='%s'", $retval .= sprintf(", %s='%s'",
$name, $GLOBALS[$name]); $name, $_REQUEST[$name]);
} }
} }
@ -437,7 +477,7 @@
$name = sprintf("%s%x", $base, $i); $name = sprintf("%s%x", $base, $i);
if (isset($GLOBALS[$name])) if (isset($_REQUEST[$name]))
$retval++; $retval++;
} }
@ -458,13 +498,14 @@
function gen_eth_addr($serno) { function gen_eth_addr($serno) {
$ethaddr_high = (mt_rand(0, 65535) & 0xfeff) | 0x0200; $ethaddr_hgh = (mt_rand(0, 65535) & 0xfeff) | 0x0200;
$ethaddr_low = mt_rand(0, 4294967295); $ethaddr_mid = mt_rand(0, 65535);
$ethaddr_low = mt_rand(0, 65535);
return sprintf("%02lx:%02lx:%02lx:%02lx:%02lx:%02lx", return sprintf("%02lx:%02lx:%02lx:%02lx:%02lx:%02lx",
$ethaddr_high >> 8, $ethaddr_high & 0xff, $ethaddr_hgh >> 8, $ethaddr_hgh & 0xff,
$ethaddr_low >> 24, ($ethaddr_low >> 16) & 0xff, $ethaddr_mid >> 8, $ethaddr_mid & 0xff,
($ethaddr_low >> 8) & 0xff, $ethaddr_low & 0xff); $ethaddr_low >> 8, $ethaddr_low & 0xff);
} }
// check that an ethernet address is valid // check that an ethernet address is valid

View File

@ -10,8 +10,9 @@
pg_head("$bddb_label - Delete Board Results"); pg_head("$bddb_label - Delete Board Results");
if (!($serno=intval($serno))) if (!isset($_REQUEST['serno']))
die("the board serial number was not specified"); die("the board serial number was not specified");
$serno=intval($_REQUEST['serno']);
mysql_query("delete from boards where serno=$serno"); mysql_query("delete from boards where serno=$serno");

View File

@ -10,11 +10,13 @@
pg_head("$bddb_label - Delete Log Entry Results"); pg_head("$bddb_label - Delete Log Entry Results");
if (!($serno=intval($serno))) if (!isset($_REQUEST['serno']))
die("the board serial number was not specified"); die("the board serial number was not specified");
$serno=intval($_REQUEST['serno']);
if (!isset($logno) || $logno == 0) if (!isset($_REQUEST['logno']) || $_REQUEST['logno'] == 0)
die("the log entry number not specified!"); die("the log entry number not specified!");
$logno=$_REQUEST['logno'];
mysql_query("delete from log where serno=$serno and logno=$logno"); mysql_query("delete from log where serno=$serno and logno=$logno");

View File

@ -10,18 +10,21 @@
pg_head("$bddb_label - Edit Board Results"); pg_head("$bddb_label - Edit Board Results");
if ($serno == 0) if (!isset($_REQUEST['serno']) || $_REQUEST['serno'] == '')
die("the board serial number was not specified"); die("the board serial number was not specified");
$serno=intval($_REQUEST['serno']);
$query="update boards set"; $query="update boards set";
if (isset($ethaddr)) { if (isset($_REQUEST['ethaddr'])) {
$ethaddr=$_REQUEST['ethaddr'];
if (!eth_addr_is_valid($ethaddr)) if (!eth_addr_is_valid($ethaddr))
die("ethaddr is invalid ('$ethaddr')"); die("ethaddr is invalid ('$ethaddr')");
$query.=" ethaddr='$ethaddr',"; $query.=" ethaddr='$ethaddr',";
} }
if (isset($date)) { if (isset($_REQUEST['date'])) {
$date=$_REQUEST['date'];
list($y, $m, $d) = split("-", $date); list($y, $m, $d) = split("-", $date);
if (!checkdate($m, $d, $y) || $y < 1999) if (!checkdate($m, $d, $y) || $y < 1999)
die("date is invalid (input '$date', " . die("date is invalid (input '$date', " .
@ -29,31 +32,36 @@
$query.=" date='$date'"; $query.=" date='$date'";
} }
if (isset($batch)) { if (isset($_REQUEST['batch'])) {
$batch=$_REQUEST['batch'];
if (strlen($batch) > 32) if (strlen($batch) > 32)
die("batch field too long (>32)"); die("batch field too long (>32)");
$query.=", batch='$batch'"; $query.=", batch='$batch'";
} }
if (isset($type)) { if (isset($_REQUEST['type'])) {
$type=$_REQUEST['type'];
if (!in_array($type, $type_vals)) if (!in_array($type, $type_vals))
die("Invalid type ($type) specified"); die("Invalid type ($type) specified");
$query.=", type='$type'"; $query.=", type='$type'";
} }
if (isset($rev)) { if (isset($_REQUEST['rev'])) {
$rev=$_REQUEST['rev'];
if (($rev = intval($rev)) <= 0 || $rev > 255) if (($rev = intval($rev)) <= 0 || $rev > 255)
die("Revision number is invalid ($rev)"); die("Revision number is invalid ($rev)");
$query.=sprintf(", rev=%d", $rev); $query.=sprintf(", rev=%d", $rev);
} }
if (isset($location)) { if (isset($_REQUEST['location'])) {
$location=$_REQUEST['location'];
if (strlen($location) > 64) if (strlen($location) > 64)
die("location field too long (>64)"); die("location field too long (>64)");
$query.=", location='$location'"; $query.=", location='$location'";
} }
if (isset($comments)) if (isset($_REQUEST['comments']))
$comments=$_REQUEST['comments'];
$query.=", comments='" . rawurlencode($comments) . "'"; $query.=", comments='" . rawurlencode($comments) . "'";
$query.=gather_enum_multi_query("sdram", 4); $query.=gather_enum_multi_query("sdram", 4);
@ -77,46 +85,54 @@
if (count_enum_multi("xlxgrd", 4) != $nxlx) if (count_enum_multi("xlxgrd", 4) != $nxlx)
die("number of xilinx grades not same as number of types"); die("number of xilinx grades not same as number of types");
if (isset($cputyp)) { if (isset($_REQUEST['cputyp'])) {
$cputyp=$_REQUEST['cputyp'];
$query.=", cputyp='$cputyp'"; $query.=", cputyp='$cputyp'";
if ($cpuspd == '') if (!isset($_REQUEST['cpuspd']) || $_REQUEST['cpuspd'] == '')
die("must specify cpu speed if cpu type is defined"); die("must specify cpu speed if cpu type is defined");
$cpuspd=$_REQUEST['cpuspd'];
$query.=", cpuspd='$cpuspd'"; $query.=", cpuspd='$cpuspd'";
if ($cpmspd == '') if (!isset($_REQUEST['cpmspd']) || $_REQUEST['cpmspd'] == '')
die("must specify cpm speed if cpu type is defined"); die("must specify cpm speed if cpu type is defined");
$cpmspd=$_REQUEST['cpmspd'];
$query.=", cpmspd='$cpmspd'"; $query.=", cpmspd='$cpmspd'";
if ($busspd == '') if (!isset($_REQUEST['busspd']) || $_REQUEST['busspd'] == '')
die("must specify bus speed if cpu type is defined"); die("must specify bus speed if cpu type is defined");
$busspd=$_REQUEST['busspd'];
$query.=", busspd='$busspd'"; $query.=", busspd='$busspd'";
} }
else { else {
if (isset($cpuspd)) if (isset($_REQUEST['cpuspd']))
die("can't specify cpu speed if there is no cpu"); die("can't specify cpu speed if there is no cpu");
if (isset($cpmspd)) if (isset($_REQUEST['cpmspd']))
die("can't specify cpm speed if there is no cpu"); die("can't specify cpm speed if there is no cpu");
if (isset($busspd)) if (isset($_REQUEST['busspd']))
die("can't specify bus speed if there is no cpu"); die("can't specify bus speed if there is no cpu");
} }
if (isset($hschin)) { if (isset($_REQUEST['hschin'])) {
$hschin=$_REQUEST['hschin'];
if (($hschin = intval($hschin)) < 0 || $hschin > 4) if (($hschin = intval($hschin)) < 0 || $hschin > 4)
die("Invalid number of hs input chans ($hschin)"); die("Invalid number of hs input chans ($hschin)");
} }
else else
$hschin = 0; $hschin = 0;
if (isset($hschout)) { if (isset($_REQUEST['hschout'])) {
$hschout=$_REQUEST['hschout'];
if (($hschout = intval($hschout)) < 0 || $hschout > 4) if (($hschout = intval($hschout)) < 0 || $hschout > 4)
die("Invalid number of hs output chans ($hschout)"); die("Invalid number of hs output chans ($hschout)");
} }
else else
$hschout = 0; $hschout = 0;
if (isset($hstype)) if (isset($_REQUEST['hstype'])) {
$hstype=$_REQUEST['hstype'];
$query.=", hstype='$hstype'"; $query.=", hstype='$hstype'";
}
else { else {
if ($hschin != 0) if ($_REQUEST['hschin'] != 0)
die("number of high-speed input channels must be zero" die("number of high-speed input channels must be zero"
. " if high-speed chip is not present"); . " if high-speed chip is not present");
if ($hschout != 0) if ($_REQUEST['hschout'] != 0)
die("number of high-speed output channels must be zero" die("number of high-speed output channels must be zero"
. " if high-speed chip is not present"); . " if high-speed chip is not present");
} }

View File

@ -10,15 +10,18 @@
pg_head("$bddb_label - Edit Log Entry Results"); pg_head("$bddb_label - Edit Log Entry Results");
if ($serno == 0) if (!isset($_REQUEST['serno']) || $_REQUEST['serno'] == '')
die("the board serial number was not specified"); die("the board serial number was not specified");
$serno=intval($_REQUEST['serno']);
if (!isset($logno) || $logno == 0) if (!isset($_REQUEST['logno']) || $_REQUEST['logno'] == '')
die("log number not specified!"); die("log number not specified!");
$logno=intval($_REQUEST['logno']);
$query="update log set"; $query="update log set";
if (isset($date)) { if (isset($_REQUEST['date'])) {
$date=$_REQUEST['date'];
list($y, $m, $d) = split("-", $date); list($y, $m, $d) = split("-", $date);
if (!checkdate($m, $d, $y) || $y < 1999) if (!checkdate($m, $d, $y) || $y < 1999)
die("date is invalid (input '$date', " . die("date is invalid (input '$date', " .
@ -26,11 +29,15 @@
$query.=" date='$date'"; $query.=" date='$date'";
} }
if (isset($who)) if (isset($_REQUEST['who'])) {
$who=$_REQUEST['who'];
$query.=", who='" . $who . "'"; $query.=", who='" . $who . "'";
}
if (isset($details)) if (isset($_REQUEST['details'])) {
$details=$_REQUEST['details'];
$query.=", details='" . rawurlencode($details) . "'"; $query.=", details='" . rawurlencode($details) . "'";
}
$query.=" where serno=$serno and logno=$logno"; $query.=" where serno=$serno and logno=$logno";

View File

@ -10,8 +10,10 @@
pg_head("$bddb_label - Board Registration Results"); pg_head("$bddb_label - Board Registration Results");
if (($serno=intval($serno)) != 0) if (isset($_REQUEST['serno'])) {
$serno=$_REQUEST['serno'];
die("serial number must not be set ($serno) when Creating!"); die("serial number must not be set ($serno) when Creating!");
}
$query="update boards set"; $query="update boards set";

View File

@ -10,11 +10,14 @@
pg_head("$bddb_label - Add Log Entry Results"); pg_head("$bddb_label - Add Log Entry Results");
if ($serno == 0) if (!isset($_REQUEST['serno']) || $_REQUEST['serno'] == '')
die("serial number not specified!"); die("serial number not specified!");
$serno=intval($_REQUEST['serno']);
if (isset($logno)) if (isset($_REQUEST['logno'])) {
$logno=$_REQUEST['logno'];
die("log number must not be set ($logno) when Creating!"); die("log number must not be set ($logno) when Creating!");
}
$query="update log set serno=$serno"; $query="update log set serno=$serno";
@ -23,11 +26,15 @@
die("date is invalid (input '$date', yyyy-mm-dd '$y-$m-$d')"); die("date is invalid (input '$date', yyyy-mm-dd '$y-$m-$d')");
$query.=", date='$date'"; $query.=", date='$date'";
if (isset($who)) if (isset($_REQUEST['who'])) {
$who=$_REQUEST['who'];
$query.=", who='" . $who . "'"; $query.=", who='" . $who . "'";
}
if (isset($details)) if (isset($_REQUEST['details'])) {
$details=$_REQUEST['details'];
$query.=", details='" . rawurlencode($details) . "'"; $query.=", details='" . rawurlencode($details) . "'";
}
// echo "final query = '$query'<br>\n"; // echo "final query = '$query'<br>\n";

View File

@ -11,7 +11,7 @@
pg_head("$bddb_label - Edit Board Registration"); pg_head("$bddb_label - Edit Board Registration");
if ($serno == 0) if ($serno == 0)
die("serial number not specified!"); die("serial number not specified or invalid!");
$pserno = sprintf("%010d", $serno); $pserno = sprintf("%010d", $serno);
@ -73,17 +73,17 @@
// xlxgrd[0-3] enum('NORMAL','ENGSAMP') // xlxgrd[0-3] enum('NORMAL','ENGSAMP')
print_enum_multi("xlxgrd", $row, $xlxgrd_vals, 4, array(), 1); print_enum_multi("xlxgrd", $row, $xlxgrd_vals, 4, array(), 1);
// cputyp enum('MPC8260') // cputyp enum('MPC8260(HIP3)','MPC8260A(HIP4)','MPC8280(HIP7)')
print_enum("cputyp", $row, $cputyp_vals); print_enum("cputyp", $row, $cputyp_vals);
// cpuspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ') // cpuspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ')
print_enum("cpuspd", $row, $clk_vals); print_enum_select("cpuspd", $row, $clk_vals);
// cpmspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ') // cpmspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ')
print_enum("cpmspd", $row, $clk_vals); print_enum_select("cpmspd", $row, $clk_vals);
// busspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ') // busspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ')
print_enum("busspd", $row, $clk_vals); print_enum_select("busspd", $row, $clk_vals);
// hstype enum('AMCC-S2064A') // hstype enum('AMCC-S2064A')
print_enum("hstype", $row, $hstype_vals); print_enum("hstype", $row, $hstype_vals);

View File

@ -10,11 +10,13 @@
pg_head("$bddb_label - Edit Board Log Entry"); pg_head("$bddb_label - Edit Board Log Entry");
if ($serno == 0) if (!isset($_REQUEST['serno']) || $_REQUEST['serno'] == '')
die("serial number not specified!"); die("serial number not specified!");
$serno=intval($_REQUEST['serno']);
if (!isset($logno) || $logno == 0) if (!isset($_REQUEST['logno']) || $_REQUEST['logno'] == '')
die("log number not specified!"); die("log number not specified!");
$logno=intval($_REQUEST['logno']);
$pserno = sprintf("%010d", $serno); $pserno = sprintf("%010d", $serno);
$plogno = sprintf("%010d", $logno); $plogno = sprintf("%010d", $logno);

View File

@ -4,13 +4,9 @@
// Murray Jensen <Murray.Jensen@csiro.au> // Murray Jensen <Murray.Jensen@csiro.au>
// CSIRO Manufacturing Science and Technology, Preston Lab // CSIRO Manufacturing Science and Technology, Preston Lab
if (!isset($serno)) $serno=isset($_REQUEST['serno'])?$_REQUEST['serno']:'';
$serno = 0;
else
$serno = intval($serno);
if (!isset($submit)) $submit=isset($_REQUEST['submit'])?$_REQUEST['submit']:"[NOT SET]";
$submit = "[NOT SET]";
switch ($submit) { switch ($submit) {

View File

@ -13,6 +13,7 @@
<form action=donew.php method=POST> <form action=donew.php method=POST>
<p></p> <p></p>
<?php <?php
$serno=intval($serno);
// if a serial number was supplied, fetch the record // if a serial number was supplied, fetch the record
// and use its contents as defaults // and use its contents as defaults
if ($serno != 0) { if ($serno != 0) {
@ -23,8 +24,6 @@
else else
$row = array(); $row = array();
echo "<input type=hidden name=serno value=0>\n";
begin_table(5); begin_table(5);
// date date // date date
@ -60,17 +59,17 @@
// xlxgrd[0-3] enum('NORMAL','ENGSAMP') // xlxgrd[0-3] enum('NORMAL','ENGSAMP')
print_enum_multi("xlxgrd", $row, $xlxgrd_vals, 4, array(1), 1); print_enum_multi("xlxgrd", $row, $xlxgrd_vals, 4, array(1), 1);
// cputyp enum('MPC8260') // cputyp enum('MPC8260(HIP3)','MPC8260A(HIP4)','MPC8280(HIP7)')
print_enum("cputyp", $row, $cputyp_vals, 1); print_enum("cputyp", $row, $cputyp_vals, 1);
// cpuspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ') // cpuspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ')
print_enum("cpuspd", $row, $clk_vals, 4); print_enum_select("cpuspd", $row, $clk_vals, 4);
// cpmspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ') // cpmspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ')
print_enum("cpmspd", $row, $clk_vals, 4); print_enum_select("cpmspd", $row, $clk_vals, 4);
// busspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ') // busspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ')
print_enum("busspd", $row, $clk_vals, 2); print_enum_select("busspd", $row, $clk_vals, 2);
// hstype enum('AMCC-S2064A') // hstype enum('AMCC-S2064A')
print_enum("hstype", $row, $hstype_vals, 1); print_enum("hstype", $row, $hstype_vals, 1);

View File

@ -10,11 +10,14 @@
pg_head("$bddb_label - New Log Entry"); pg_head("$bddb_label - New Log Entry");
if ($serno == 0) if (!isset($_REQUEST['serno']) || $_REQUEST['serno'] == '')
die("serial number not specified!"); die("serial number not specified or invalid!");
$serno=intval($_REQUEST['serno']);
if (isset($logno)) if (isset($_REQUEST['logno'])) {
die("log number must not be specified when adding!"); $logno=$_REQUEST['logno'];
die("log number must not be specified when adding! ($logno)");
}
?> ?>
<form action=donewlog.php method=POST> <form action=donewlog.php method=POST>
<p></p> <p></p>
@ -27,7 +30,7 @@
print_field("date", array('date' => date("Y-m-d"))); print_field("date", array('date' => date("Y-m-d")));
// who char(20) // who char(20)
print_field("who", ""); print_field("who", array());
// details text // details text
print_field_multiline("details", array(), 60, 10, 'text_filter'); print_field_multiline("details", array(), 60, 10, 'text_filter');