diff options
author | Wolfgang Denk <wd@pollux.denx.de> | 2005-08-12 23:27:18 +0200 |
---|---|---|
committer | Wolfgang Denk <wd@pollux.denx.de> | 2005-08-12 23:27:18 +0200 |
commit | d992daf99d1ce39ee18b353b67fdfa181d83fbff (patch) | |
tree | a9b5f98b73706e024bc7cd7a14ca2674bd75a55c | |
parent | f9d77ed38031fa29d1495bf3cfee385450463f5b (diff) | |
download | u-boot-imx-d992daf99d1ce39ee18b353b67fdfa181d83fbff.zip u-boot-imx-d992daf99d1ce39ee18b353b67fdfa181d83fbff.tar.gz u-boot-imx-d992daf99d1ce39ee18b353b67fdfa181d83fbff.tar.bz2 |
Update Hymod Board Database PHP code in "tools" directory
Patch by Murray Jensen, 01 Jul 2005
-rw-r--r-- | CHANGELOG | 3 | ||||
-rw-r--r-- | tools/bddb/brlog.php | 13 | ||||
-rw-r--r-- | tools/bddb/browse.php | 53 | ||||
-rw-r--r-- | tools/bddb/create_tables.sql | 78 | ||||
-rw-r--r-- | tools/bddb/defs.php | 97 | ||||
-rw-r--r-- | tools/bddb/dodelete.php | 3 | ||||
-rw-r--r-- | tools/bddb/dodellog.php | 6 | ||||
-rw-r--r-- | tools/bddb/doedit.php | 56 | ||||
-rw-r--r-- | tools/bddb/doedlog.php | 17 | ||||
-rw-r--r-- | tools/bddb/donew.php | 4 | ||||
-rw-r--r-- | tools/bddb/donewlog.php | 15 | ||||
-rw-r--r-- | tools/bddb/edit.php | 16 | ||||
-rw-r--r-- | tools/bddb/edlog.php | 6 | ||||
-rw-r--r-- | tools/bddb/execute.php | 8 | ||||
-rw-r--r-- | tools/bddb/new.php | 17 | ||||
-rw-r--r-- | tools/bddb/newlog.php | 15 |
16 files changed, 252 insertions, 155 deletions
@@ -2,6 +2,9 @@ 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 Patch by Murray Jensen, 30 Jun 2005 diff --git a/tools/bddb/brlog.php b/tools/bddb/brlog.php index e95d694..fccfbd0 100644 --- a/tools/bddb/brlog.php +++ b/tools/bddb/brlog.php @@ -10,8 +10,9 @@ pg_head("$bddb_label - Browse Board Log"); - if (!isset($serno) || $serno == 0) - die("serial number not specified!"); + $serno=intval($serno); + if ($serno == 0) + die("serial number not specified or invalid!"); function print_cell($str) { if ($str == '') @@ -55,16 +56,16 @@ <hr></hr> <p></p> <?php - $limit=abs(isset($limit)?$limit:20); - $offset=abs(isset($offset)?$offset:0); + $limit=abs(isset($_REQUEST['limit'])?$_REQUEST['limit']:20); + $offset=abs(isset($_REQUEST['offset'])?$_REQUEST['offset']:0); $lr=mysql_query("select count(*) as n from log where serno=$serno"); $lrow=mysql_fetch_array($lr); if($lrow['n']>$limit){ $preoffset=max(0,$offset-$limit); $postoffset=$offset+$limit; echo "<table width=\"100%\">\n<tr align=center>\n"; - printf("<td><%sa href=\"%s?serno=$serno&offset=%d\"><img border=0 alt=\"<\" 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=\">\" 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=\"<\" 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=\">\" src=\"/icons/right.gif\"></a></td>\n", $postoffset<$lrow['n']?"":"no", $PHP_SELF, $postoffset); echo "</tr>\n</table>\n"; } mysql_free_result($lr); diff --git a/tools/bddb/browse.php b/tools/bddb/browse.php index 0e94f7d..675dfab 100644 --- a/tools/bddb/browse.php +++ b/tools/bddb/browse.php @@ -8,29 +8,31 @@ require("defs.php"); - if (!isset($verbose)) - $verbose = 0; + $serno=isset($_REQUEST['serno'])?$_REQUEST['serno']:''; - if (!isset($serno)) - $serno = 0; + $verbose=isset($_REQUEST['verbose'])?intval($_REQUEST['verbose']):0; pg_head("$bddb_label - Browse database" . ($verbose?" (verbose)":"")); ?> <p></p> <?php - if ($serno == 0) { - $limit=abs(isset($limit)?$limit:20); - $offset=abs(isset($offset)?$offset:0); + $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 "<table width=\"100%\">\n<tr align=center>\n"; - printf("<td><%sa href=\"%s?offset=%d\"><img border=0 alt=\"<\" src=\"/icons/left.gif\"></a></td>\n", $offset>0?"":"no", $PHP_SELF, $preoffset); - printf("<td><%sa href=\"%s?offset=%d\"><img border=0 alt=\">\" src=\"/icons/right.gif\"></a></td>\n", $postoffset<$lrow['n']?"":"no", $PHP_SELF, $postoffset); + echo "<table width=\"100%\">\n<tr>\n"; + printf("<td align=left><%sa href=\"%s?submit=Browse&offset=%d&verbose=%d\"><img border=0 alt=\"<\" src=\"/icons/left.gif\"></a></td>\n", $offset>0?"":"no", $PHP_SELF, $preoffset, $verbose); + printf("<td align=right><%sa href=\"%s?submit=Browse&offset=%d&verbose=%d\"><img border=0 alt=\">\" src=\"/icons/right.gif\"></a></td>\n", $postoffset<$lrow['n']?"":"no", $PHP_SELF, $postoffset, $offset); echo "</tr>\n</table>\n"; } + mysql_free_result($lr); } ?> @@ -65,10 +67,28 @@ ?> </tr> <?php - if ($serno == 0) - $r=mysql_query("select * from boards order by serno limit $offset,$limit"); - else - $r=mysql_query("select * from boards where serno=$serno"); + $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 <= $m1) + die("bad serial number range ($s)"); + $query .= $pre . "(serno>=$m[1] and serno<=$m[2])"; + } + 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 == '') @@ -117,10 +137,7 @@ <table width="100%"> <tr> <td align=center><?php - if ($verbose) - echo "<a href=\"browse.php?verbose=0\">Terse Listing</a>"; - else - echo "<a href=\"browse.php?verbose=1\">Verbose Listing</a>"; + 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"); ?></td> <td align=center><a href="index.php">Back to Start</a></td> </tr> diff --git a/tools/bddb/create_tables.sql b/tools/bddb/create_tables.sql index 4c25dd1..a2a5788 100644 --- a/tools/bddb/create_tables.sql +++ b/tools/bddb/create_tables.sql @@ -22,38 +22,38 @@ CREATE TABLE boards ( rev tinyint(3) unsigned zerofill NOT NULL, location char(64), comments text, - sdram0 enum('32M','64M','128M','256M'), - sdram1 enum('32M','64M','128M','256M'), - sdram2 enum('32M','64M','128M','256M'), - sdram3 enum('32M','64M','128M','256M'), - flash0 enum('4M','8M','16M','32M','64M'), - flash1 enum('4M','8M','16M','32M','64M'), - flash2 enum('4M','8M','16M','32M','64M'), - flash3 enum('4M','8M','16M','32M','64M'), - zbt0 enum('512K','1M','2M','4M'), - zbt1 enum('512K','1M','2M','4M'), - zbt2 enum('512K','1M','2M','4M'), - zbt3 enum('512K','1M','2M','4M'), - zbt4 enum('512K','1M','2M','4M'), - zbt5 enum('512K','1M','2M','4M'), - zbt6 enum('512K','1M','2M','4M'), - zbt7 enum('512K','1M','2M','4M'), - zbt8 enum('512K','1M','2M','4M'), - zbt9 enum('512K','1M','2M','4M'), - zbta enum('512K','1M','2M','4M'), - zbtb enum('512K','1M','2M','4M'), - zbtc enum('512K','1M','2M','4M'), - zbtd enum('512K','1M','2M','4M'), - zbte enum('512K','1M','2M','4M'), - zbtf enum('512K','1M','2M','4M'), - xlxtyp0 enum('XCV300E','XCV400E','XCV600E'), - xlxtyp1 enum('XCV300E','XCV400E','XCV600E'), - xlxtyp2 enum('XCV300E','XCV400E','XCV600E'), - xlxtyp3 enum('XCV300E','XCV400E','XCV600E'), - xlxspd0 enum('6','7','8'), - xlxspd1 enum('6','7','8'), - xlxspd2 enum('6','7','8'), - xlxspd3 enum('6','7','8'), + sdram0 enum('32M','64M','128M','256M','512M','1G','2G','4G'), + sdram1 enum('32M','64M','128M','256M','512M','1G','2G','4G'), + sdram2 enum('32M','64M','128M','256M','512M','1G','2G','4G'), + sdram3 enum('32M','64M','128M','256M','512M','1G','2G','4G'), + flash0 enum('4M','8M','16M','32M','64M','128M','256M','512M','1G'), + flash1 enum('4M','8M','16M','32M','64M','128M','256M','512M','1G'), + flash2 enum('4M','8M','16M','32M','64M','128M','256M','512M','1G'), + flash3 enum('4M','8M','16M','32M','64M','128M','256M','512M','1G'), + zbt0 enum('512K','1M','2M','4M','8M','16M'), + zbt1 enum('512K','1M','2M','4M','8M','16M'), + zbt2 enum('512K','1M','2M','4M','8M','16M'), + zbt3 enum('512K','1M','2M','4M','8M','16M'), + zbt4 enum('512K','1M','2M','4M','8M','16M'), + zbt5 enum('512K','1M','2M','4M','8M','16M'), + zbt6 enum('512K','1M','2M','4M','8M','16M'), + zbt7 enum('512K','1M','2M','4M','8M','16M'), + zbt8 enum('512K','1M','2M','4M','8M','16M'), + zbt9 enum('512K','1M','2M','4M','8M','16M'), + zbta enum('512K','1M','2M','4M','8M','16M'), + zbtb enum('512K','1M','2M','4M','8M','16M'), + zbtc enum('512K','1M','2M','4M','8M','16M'), + zbtd enum('512K','1M','2M','4M','8M','16M'), + zbte enum('512K','1M','2M','4M','8M','16M'), + zbtf enum('512K','1M','2M','4M','8M','16M'), + 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','XC2V2000','XC2V3000','XC2V4000','XC2V6000','XC2VP2','XC2VP4','XC2VP7','XC2VP20','XC2VP30','XC2VP50','XC4VFX20','XC4VFX40','XC4VFX60','XC4VFX100','XC4VFX140'), + 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','XC2V2000','XC2V3000','XC2V4000','XC2V6000','XC2VP2','XC2VP4','XC2VP7','XC2VP20','XC2VP30','XC2VP50','XC4VFX20','XC4VFX40','XC4VFX60','XC4VFX100','XC4VFX140'), + xlxspd0 enum('6','7','8','4','5','9','10','11','12'), + xlxspd1 enum('6','7','8','4','5','9','10','11','12'), + xlxspd2 enum('6','7','8','4','5','9','10','11','12'), + xlxspd3 enum('6','7','8','4','5','9','10','11','12'), xlxtmp0 enum('COM','IND'), xlxtmp1 enum('COM','IND'), xlxtmp2 enum('COM','IND'), @@ -62,13 +62,13 @@ CREATE TABLE boards ( xlxgrd1 enum('NORMAL','ENGSAMP'), xlxgrd2 enum('NORMAL','ENGSAMP'), xlxgrd3 enum('NORMAL','ENGSAMP'), - cputyp enum('MPC8260'), - cpuspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ'), - cpmspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ'), - busspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ'), - hstype enum('AMCC-S2064A'), - hschin enum('0','1','2','3','4'), - hschout enum('0','1','2','3','4'), + cputyp enum('MPC8260(HIP3)','MPC8260A(HIP4)','MPC8280(HIP7)','MPC8560'), + 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','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','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','Xilinx-Rockets'), + 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','5','6','7','8','9','10','11','12','13','14','15','16'), PRIMARY KEY (serno), KEY serno (serno), UNIQUE serno_2 (serno) diff --git a/tools/bddb/defs.php b/tools/bddb/defs.php index be8a3b9..b7518e3 100644 --- a/tools/bddb/defs.php +++ b/tools/bddb/defs.php @@ -7,7 +7,7 @@ // contains mysql user id and password - keep secret require("config.php"); - if (isset($logout)) { + if (isset($_REQUEST['logout'])) { Header("status: 401 Unauthorized"); Header("HTTP/1.0 401 Unauthorized"); Header("WWW-authenticate: basic realm=\"$bddb_label\""); @@ -45,32 +45,40 @@ // board type $type_vals = array('IO','CLP','DSP','INPUT','ALT-INPUT','DISPLAY'); - // sdram sizes (nbits array is for write into eeprom config file) - $sdram_vals = array('','32M','64M','128M','256M'); - $sdram_nbits = array(0,25,26,27,28); + // Xilinx fpga types + $xlxtyp_vals = array('','XCV300E','XCV400E','XCV600E','XC2V2000','XC2V3000','XC2V4000','XC2V6000','XC2VP2','XC2VP4','XC2VP7','XC2VP20','XC2VP30','XC2VP50','XC4VFX20','XC4VFX40','XC4VFX60','XC4VFX100','XC4VFX140'); - // flash sizes (nbits array is for write into eeprom config file) - $flash_vals = array('','4M','8M','16M','32M','64M'); - $flash_nbits = array(0,22,23,24,25,26); + // Xilinx fpga speeds + $xlxspd_vals = array('','6','7','8','4','5','9','10','11','12'); - // zbt ram sizes (nbits array is for write into eeprom config file) - $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'); + // Xilinx fpga temperatures (commercial or industrial) $xlxtmp_vals = array('','COM','IND'); + + // Xilinx fpga grades (normal or engineering sample) $xlxgrd_vals = array('','NORMAL','ENGSAMP'); - // processor attributes - $cputyp_vals = array('','MPC8260'); - $clk_vals = array('','33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ'); + // CPU types + $cputyp_vals = array('','MPC8260(HIP3)','MPC8260A(HIP4)','MPC8280(HIP7)','MPC8560'); + + // 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 - $hstype_vals = array('','AMCC-S2064A'); - $hschin_vals = array('0','1','2','3','4'); - $hschout_vals = array('0','1','2','3','4'); + $hstype_vals = array('','AMCC-S2064A','Xilinx-Rockets'); + $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','5','6','7','8','9','10','11','12','13','14','15','16'); // value filters - used when outputting html function rev_filter($num) { @@ -310,6 +318,38 @@ 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 function print_enum_multi($base, $array, $vals, $cnt, $defs, $grp = 0) { @@ -375,9 +415,9 @@ $name = sprintf("%s%x", $base, $i); - if (isset($GLOBALS[$name])) { + if (isset($_REQUEST[$name])) { $retval .= sprintf(", %s='%s'", - $name, $GLOBALS[$name]); + $name, $_REQUEST[$name]); } } @@ -437,7 +477,7 @@ $name = sprintf("%s%x", $base, $i); - if (isset($GLOBALS[$name])) + if (isset($_REQUEST[$name])) $retval++; } @@ -458,13 +498,14 @@ function gen_eth_addr($serno) { - $ethaddr_high = (mt_rand(0, 65535) & 0xfeff) | 0x0200; - $ethaddr_low = mt_rand(0, 4294967295); + $ethaddr_hgh = (mt_rand(0, 65535) & 0xfeff) | 0x0200; + $ethaddr_mid = mt_rand(0, 65535); + $ethaddr_low = mt_rand(0, 65535); return sprintf("%02lx:%02lx:%02lx:%02lx:%02lx:%02lx", - $ethaddr_high >> 8, $ethaddr_high & 0xff, - $ethaddr_low >> 24, ($ethaddr_low >> 16) & 0xff, - ($ethaddr_low >> 8) & 0xff, $ethaddr_low & 0xff); + $ethaddr_hgh >> 8, $ethaddr_hgh & 0xff, + $ethaddr_mid >> 8, $ethaddr_mid & 0xff, + $ethaddr_low >> 8, $ethaddr_low & 0xff); } // check that an ethernet address is valid diff --git a/tools/bddb/dodelete.php b/tools/bddb/dodelete.php index f1567d2..4839e36 100644 --- a/tools/bddb/dodelete.php +++ b/tools/bddb/dodelete.php @@ -10,8 +10,9 @@ pg_head("$bddb_label - Delete Board Results"); - if (!($serno=intval($serno))) + if (!isset($_REQUEST['serno'])) die("the board serial number was not specified"); + $serno=intval($_REQUEST['serno']); mysql_query("delete from boards where serno=$serno"); diff --git a/tools/bddb/dodellog.php b/tools/bddb/dodellog.php index 5942ec9..9dd78c1 100644 --- a/tools/bddb/dodellog.php +++ b/tools/bddb/dodellog.php @@ -10,11 +10,13 @@ pg_head("$bddb_label - Delete Log Entry Results"); - if (!($serno=intval($serno))) + if (!isset($_REQUEST['serno'])) 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!"); + $logno=$_REQUEST['logno']; mysql_query("delete from log where serno=$serno and logno=$logno"); diff --git a/tools/bddb/doedit.php b/tools/bddb/doedit.php index a46ea10..13fbb69 100644 --- a/tools/bddb/doedit.php +++ b/tools/bddb/doedit.php @@ -10,18 +10,21 @@ pg_head("$bddb_label - Edit Board Results"); - if ($serno == 0) + if (!isset($_REQUEST['serno']) || $_REQUEST['serno'] == '') die("the board serial number was not specified"); + $serno=intval($_REQUEST['serno']); $query="update boards set"; - if (isset($ethaddr)) { + if (isset($_REQUEST['ethaddr'])) { + $ethaddr=$_REQUEST['ethaddr']; if (!eth_addr_is_valid($ethaddr)) die("ethaddr is invalid ('$ethaddr')"); $query.=" ethaddr='$ethaddr',"; } - if (isset($date)) { + if (isset($_REQUEST['date'])) { + $date=$_REQUEST['date']; list($y, $m, $d) = split("-", $date); if (!checkdate($m, $d, $y) || $y < 1999) die("date is invalid (input '$date', " . @@ -29,31 +32,36 @@ $query.=" date='$date'"; } - if (isset($batch)) { + if (isset($_REQUEST['batch'])) { + $batch=$_REQUEST['batch']; if (strlen($batch) > 32) die("batch field too long (>32)"); $query.=", batch='$batch'"; } - if (isset($type)) { + if (isset($_REQUEST['type'])) { + $type=$_REQUEST['type']; if (!in_array($type, $type_vals)) die("Invalid type ($type) specified"); $query.=", type='$type'"; } - if (isset($rev)) { + if (isset($_REQUEST['rev'])) { + $rev=$_REQUEST['rev']; if (($rev = intval($rev)) <= 0 || $rev > 255) die("Revision number is invalid ($rev)"); $query.=sprintf(", rev=%d", $rev); } - if (isset($location)) { + if (isset($_REQUEST['location'])) { + $location=$_REQUEST['location']; if (strlen($location) > 64) die("location field too long (>64)"); $query.=", location='$location'"; } - if (isset($comments)) + if (isset($_REQUEST['comments'])) + $comments=$_REQUEST['comments']; $query.=", comments='" . rawurlencode($comments) . "'"; $query.=gather_enum_multi_query("sdram", 4); @@ -77,46 +85,54 @@ if (count_enum_multi("xlxgrd", 4) != $nxlx) die("number of xilinx grades not same as number of types"); - if (isset($cputyp)) { + if (isset($_REQUEST['cputyp'])) { + $cputyp=$_REQUEST['cputyp']; $query.=", cputyp='$cputyp'"; - if ($cpuspd == '') + if (!isset($_REQUEST['cpuspd']) || $_REQUEST['cpuspd'] == '') die("must specify cpu speed if cpu type is defined"); + $cpuspd=$_REQUEST['cpuspd']; $query.=", cpuspd='$cpuspd'"; - if ($cpmspd == '') + if (!isset($_REQUEST['cpmspd']) || $_REQUEST['cpmspd'] == '') die("must specify cpm speed if cpu type is defined"); + $cpmspd=$_REQUEST['cpmspd']; $query.=", cpmspd='$cpmspd'"; - if ($busspd == '') + if (!isset($_REQUEST['busspd']) || $_REQUEST['busspd'] == '') die("must specify bus speed if cpu type is defined"); + $busspd=$_REQUEST['busspd']; $query.=", busspd='$busspd'"; } else { - if (isset($cpuspd)) + if (isset($_REQUEST['cpuspd'])) 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"); - if (isset($busspd)) + if (isset($_REQUEST['busspd'])) 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) die("Invalid number of hs input chans ($hschin)"); } else $hschin = 0; - if (isset($hschout)) { + if (isset($_REQUEST['hschout'])) { + $hschout=$_REQUEST['hschout']; if (($hschout = intval($hschout)) < 0 || $hschout > 4) die("Invalid number of hs output chans ($hschout)"); } else $hschout = 0; - if (isset($hstype)) + if (isset($_REQUEST['hstype'])) { + $hstype=$_REQUEST['hstype']; $query.=", hstype='$hstype'"; + } else { - if ($hschin != 0) + if ($_REQUEST['hschin'] != 0) die("number of high-speed input channels must be zero" . " if high-speed chip is not present"); - if ($hschout != 0) + if ($_REQUEST['hschout'] != 0) die("number of high-speed output channels must be zero" . " if high-speed chip is not present"); } diff --git a/tools/bddb/doedlog.php b/tools/bddb/doedlog.php index 21e50b0..7009aa7 100644 --- a/tools/bddb/doedlog.php +++ b/tools/bddb/doedlog.php @@ -10,15 +10,18 @@ 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"); + $serno=intval($_REQUEST['serno']); - if (!isset($logno) || $logno == 0) + if (!isset($_REQUEST['logno']) || $_REQUEST['logno'] == '') die("log number not specified!"); + $logno=intval($_REQUEST['logno']); $query="update log set"; - if (isset($date)) { + if (isset($_REQUEST['date'])) { + $date=$_REQUEST['date']; list($y, $m, $d) = split("-", $date); if (!checkdate($m, $d, $y) || $y < 1999) die("date is invalid (input '$date', " . @@ -26,11 +29,15 @@ $query.=" date='$date'"; } - if (isset($who)) + if (isset($_REQUEST['who'])) { + $who=$_REQUEST['who']; $query.=", who='" . $who . "'"; + } - if (isset($details)) + if (isset($_REQUEST['details'])) { + $details=$_REQUEST['details']; $query.=", details='" . rawurlencode($details) . "'"; + } $query.=" where serno=$serno and logno=$logno"; diff --git a/tools/bddb/donew.php b/tools/bddb/donew.php index b1288d6..39b2c78 100644 --- a/tools/bddb/donew.php +++ b/tools/bddb/donew.php @@ -10,8 +10,10 @@ 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!"); + } $query="update boards set"; diff --git a/tools/bddb/donewlog.php b/tools/bddb/donewlog.php index c3b9606..7635d29 100644 --- a/tools/bddb/donewlog.php +++ b/tools/bddb/donewlog.php @@ -10,11 +10,14 @@ pg_head("$bddb_label - Add Log Entry Results"); - if ($serno == 0) + if (!isset($_REQUEST['serno']) || $_REQUEST['serno'] == '') 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!"); + } $query="update log set serno=$serno"; @@ -23,11 +26,15 @@ die("date is invalid (input '$date', yyyy-mm-dd '$y-$m-$d')"); $query.=", date='$date'"; - if (isset($who)) + if (isset($_REQUEST['who'])) { + $who=$_REQUEST['who']; $query.=", who='" . $who . "'"; + } - if (isset($details)) + if (isset($_REQUEST['details'])) { + $details=$_REQUEST['details']; $query.=", details='" . rawurlencode($details) . "'"; + } // echo "final query = '$query'<br>\n"; diff --git a/tools/bddb/edit.php b/tools/bddb/edit.php index 155e848..dd8c26c 100644 --- a/tools/bddb/edit.php +++ b/tools/bddb/edit.php @@ -11,7 +11,7 @@ pg_head("$bddb_label - Edit Board Registration"); if ($serno == 0) - die("serial number not specified!"); + die("serial number not specified or invalid!"); $pserno = sprintf("%010d", $serno); @@ -73,17 +73,17 @@ // xlxgrd[0-3] enum('NORMAL','ENGSAMP') 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); - // cpuspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ') - print_enum("cpuspd", $row, $clk_vals); + // cpuspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ') + print_enum_select("cpuspd", $row, $clk_vals); - // cpmspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ') - print_enum("cpmspd", $row, $clk_vals); + // cpmspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ') + print_enum_select("cpmspd", $row, $clk_vals); - // busspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ') - print_enum("busspd", $row, $clk_vals); + // busspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ') + print_enum_select("busspd", $row, $clk_vals); // hstype enum('AMCC-S2064A') print_enum("hstype", $row, $hstype_vals); diff --git a/tools/bddb/edlog.php b/tools/bddb/edlog.php index 375dca3..8befd35 100644 --- a/tools/bddb/edlog.php +++ b/tools/bddb/edlog.php @@ -10,11 +10,13 @@ pg_head("$bddb_label - Edit Board Log Entry"); - if ($serno == 0) + if (!isset($_REQUEST['serno']) || $_REQUEST['serno'] == '') 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!"); + $logno=intval($_REQUEST['logno']); $pserno = sprintf("%010d", $serno); $plogno = sprintf("%010d", $logno); diff --git a/tools/bddb/execute.php b/tools/bddb/execute.php index 4cc87c7..0b62882 100644 --- a/tools/bddb/execute.php +++ b/tools/bddb/execute.php @@ -4,13 +4,9 @@ // Murray Jensen <Murray.Jensen@csiro.au> // CSIRO Manufacturing Science and Technology, Preston Lab - if (!isset($serno)) - $serno = 0; - else - $serno = intval($serno); + $serno=isset($_REQUEST['serno'])?$_REQUEST['serno']:''; - if (!isset($submit)) - $submit = "[NOT SET]"; + $submit=isset($_REQUEST['submit'])?$_REQUEST['submit']:"[NOT SET]"; switch ($submit) { diff --git a/tools/bddb/new.php b/tools/bddb/new.php index 618194c..30323ff 100644 --- a/tools/bddb/new.php +++ b/tools/bddb/new.php @@ -13,6 +13,7 @@ <form action=donew.php method=POST> <p></p> <?php + $serno=intval($serno); // if a serial number was supplied, fetch the record // and use its contents as defaults if ($serno != 0) { @@ -23,8 +24,6 @@ else $row = array(); - echo "<input type=hidden name=serno value=0>\n"; - begin_table(5); // date date @@ -60,17 +59,17 @@ // xlxgrd[0-3] enum('NORMAL','ENGSAMP') 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); - // cpuspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ') - print_enum("cpuspd", $row, $clk_vals, 4); + // cpuspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ') + print_enum_select("cpuspd", $row, $clk_vals, 4); - // cpmspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ') - print_enum("cpmspd", $row, $clk_vals, 4); + // cpmspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ') + print_enum_select("cpmspd", $row, $clk_vals, 4); - // busspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ') - print_enum("busspd", $row, $clk_vals, 2); + // busspd enum('33MHZ','66MHZ','100MHZ','133MHZ','166MHZ','200MHZ','233MHZ','266MHZ') + print_enum_select("busspd", $row, $clk_vals, 2); // hstype enum('AMCC-S2064A') print_enum("hstype", $row, $hstype_vals, 1); diff --git a/tools/bddb/newlog.php b/tools/bddb/newlog.php index 70f62ff..609bb85 100644 --- a/tools/bddb/newlog.php +++ b/tools/bddb/newlog.php @@ -10,11 +10,14 @@ pg_head("$bddb_label - New Log Entry"); - if ($serno == 0) - die("serial number not specified!"); - - if (isset($logno)) - die("log number must not be specified when adding!"); + if (!isset($_REQUEST['serno']) || $_REQUEST['serno'] == '') + die("serial number not specified or invalid!"); + $serno=intval($_REQUEST['serno']); + + if (isset($_REQUEST['logno'])) { + $logno=$_REQUEST['logno']; + die("log number must not be specified when adding! ($logno)"); + } ?> <form action=donewlog.php method=POST> <p></p> @@ -27,7 +30,7 @@ print_field("date", array('date' => date("Y-m-d"))); // who char(20) - print_field("who", ""); + print_field("who", array()); // details text print_field_multiline("details", array(), 60, 10, 'text_filter'); |