1 <?php // php pages made with phpMyBuilder <http://kyber.dk/phpMyBuilder> ?>
4 // Murray Jensen <Murray.Jensen@csiro.au>
5 // CSIRO Manufacturing Science and Technology, Preston Lab
7 // doedit page (hymod_bddb / boards)
11 pg_head("$bddb_label - Edit Board Results");
13 if (!isset($_REQUEST['serno']) || $_REQUEST['serno'] == '')
14 die("the board serial number was not specified");
15 $serno=intval($_REQUEST['serno']);
17 $query="update boards set";
19 if (isset($_REQUEST['ethaddr'])) {
20 $ethaddr=$_REQUEST['ethaddr'];
21 if (!eth_addr_is_valid($ethaddr))
22 die("ethaddr is invalid ('$ethaddr')");
23 $query.=" ethaddr='$ethaddr',";
26 if (isset($_REQUEST['date'])) {
27 $date=$_REQUEST['date'];
28 list($y, $m, $d) = split("-", $date);
29 if (!checkdate($m, $d, $y) || $y < 1999)
30 die("date is invalid (input '$date', " .
31 "yyyy-mm-dd '$y-$m-$d')");
32 $query.=" date='$date'";
35 if (isset($_REQUEST['batch'])) {
36 $batch=$_REQUEST['batch'];
37 if (strlen($batch) > 32)
38 die("batch field too long (>32)");
39 $query.=", batch='$batch'";
42 if (isset($_REQUEST['type'])) {
43 $type=$_REQUEST['type'];
44 if (!in_array($type, $type_vals))
45 die("Invalid type ($type) specified");
46 $query.=", type='$type'";
49 if (isset($_REQUEST['rev'])) {
50 $rev=$_REQUEST['rev'];
51 if (($rev = intval($rev)) <= 0 || $rev > 255)
52 die("Revision number is invalid ($rev)");
53 $query.=sprintf(", rev=%d", $rev);
56 if (isset($_REQUEST['location'])) {
57 $location=$_REQUEST['location'];
58 if (strlen($location) > 64)
59 die("location field too long (>64)");
60 $query.=", location='$location'";
63 if (isset($_REQUEST['comments']))
64 $comments=$_REQUEST['comments'];
65 $query.=", comments='" . rawurlencode($comments) . "'";
67 $query.=gather_enum_multi_query("sdram", 4);
69 $query.=gather_enum_multi_query("flash", 4);
71 $query.=gather_enum_multi_query("zbt", 16);
73 $query.=gather_enum_multi_query("xlxtyp", 4);
74 $nxlx = count_enum_multi("xlxtyp", 4);
76 $query.=gather_enum_multi_query("xlxspd", 4);
77 if (count_enum_multi("xlxspd", 4) != $nxlx)
78 die("number of xilinx speeds not same as number of types");
80 $query.=gather_enum_multi_query("xlxtmp", 4);
81 if (count_enum_multi("xlxtmp", 4) != $nxlx)
82 die("number of xilinx temps. not same as number of types");
84 $query.=gather_enum_multi_query("xlxgrd", 4);
85 if (count_enum_multi("xlxgrd", 4) != $nxlx)
86 die("number of xilinx grades not same as number of types");
88 if (isset($_REQUEST['cputyp'])) {
89 $cputyp=$_REQUEST['cputyp'];
90 $query.=", cputyp='$cputyp'";
91 if (!isset($_REQUEST['cpuspd']) || $_REQUEST['cpuspd'] == '')
92 die("must specify cpu speed if cpu type is defined");
93 $cpuspd=$_REQUEST['cpuspd'];
94 $query.=", cpuspd='$cpuspd'";
95 if (!isset($_REQUEST['cpmspd']) || $_REQUEST['cpmspd'] == '')
96 die("must specify cpm speed if cpu type is defined");
97 $cpmspd=$_REQUEST['cpmspd'];
98 $query.=", cpmspd='$cpmspd'";
99 if (!isset($_REQUEST['busspd']) || $_REQUEST['busspd'] == '')
100 die("must specify bus speed if cpu type is defined");
101 $busspd=$_REQUEST['busspd'];
102 $query.=", busspd='$busspd'";
105 if (isset($_REQUEST['cpuspd']))
106 die("can't specify cpu speed if there is no cpu");
107 if (isset($_REQUEST['cpmspd']))
108 die("can't specify cpm speed if there is no cpu");
109 if (isset($_REQUEST['busspd']))
110 die("can't specify bus speed if there is no cpu");
113 if (isset($_REQUEST['hschin'])) {
114 $hschin=$_REQUEST['hschin'];
115 if (($hschin = intval($hschin)) < 0 || $hschin > 4)
116 die("Invalid number of hs input chans ($hschin)");
120 if (isset($_REQUEST['hschout'])) {
121 $hschout=$_REQUEST['hschout'];
122 if (($hschout = intval($hschout)) < 0 || $hschout > 4)
123 die("Invalid number of hs output chans ($hschout)");
127 if (isset($_REQUEST['hstype'])) {
128 $hstype=$_REQUEST['hstype'];
129 $query.=", hstype='$hstype'";
132 if ($_REQUEST['hschin'] != 0)
133 die("number of high-speed input channels must be zero"
134 . " if high-speed chip is not present");
135 if ($_REQUEST['hschout'] != 0)
136 die("number of high-speed output channels must be zero"
137 . " if high-speed chip is not present");
139 $query.=", hschin='$hschin'";
140 $query.=", hschout='$hschout'";
142 $query.=" where serno=$serno";
146 $errstr = mysql_error();
147 echo "\t<font size=+4>\n";
149 echo "\t\t\tThe following error was encountered:\n";
151 echo "\t\t<center>\n";
152 printf("\t\t\t<b>%s</b>\n", $errstr);
153 echo "\t\t</center>\n";
157 $sernos = array($serno);
160 write_eeprom_cfg_file();
162 echo "\t<font size=+2>\n";
164 echo "\t\t\tThe board with serial number <b>$serno</b> was"
165 . " successfully updated";
167 $errstr = $cfgerrs[0];
169 echo "(but the cfg file update failed: $errstr)";
178 <table align=center width="100%">
180 <td align=center><a href="browse.php">Back to Browse</a></td>
181 <td align=center><a href="index.php">Back to Start</a></td>