1 | <?php
|
---|
2 | /*
|
---|
3 | function PrintTable($table)
|
---|
4 | {
|
---|
5 | $db_id = mysql_connect("hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");
|
---|
6 | if ($db_id==FALSE)
|
---|
7 | {
|
---|
8 | printf("mysql_connect returned the following error:<br>");
|
---|
9 | printf("%s<br>", mysql_error());
|
---|
10 | die("");
|
---|
11 | }
|
---|
12 | printf("%s<br>", $table);
|
---|
13 | printf("<table BORDER=\"1\">");
|
---|
14 |
|
---|
15 | $query = "EXPLAIN ";
|
---|
16 | $query .= $table;
|
---|
17 |
|
---|
18 | $result = mysql_query($query);
|
---|
19 | $numrows = mysql_num_rows($result);
|
---|
20 | $numcols = mysql_num_fields($result);
|
---|
21 | printf("%d x %d<br>", $numrows, $numcols);
|
---|
22 |
|
---|
23 | printf("<tr>");
|
---|
24 | for ($i=0; $i<$numrows; $i++)
|
---|
25 | {
|
---|
26 | $row = mysql_fetch_row($result);
|
---|
27 | printf("<th>%s</th> ", $row[0]);
|
---|
28 | }
|
---|
29 | printf("</tr>");
|
---|
30 |
|
---|
31 | $query = "SELECT * FROM ";
|
---|
32 | $query .= $table;
|
---|
33 |
|
---|
34 | $result = mysql_query($query);
|
---|
35 |
|
---|
36 | $numrows = mysql_num_rows($result);
|
---|
37 | $numcols = mysql_num_fields($result);
|
---|
38 | printf("%d x %d<br>", $numrows, $numcols);
|
---|
39 |
|
---|
40 | while ($row = mysql_fetch_row($result))
|
---|
41 | {
|
---|
42 | printf("<tr>");
|
---|
43 | foreach ($row as $entry)
|
---|
44 | {
|
---|
45 | printf("<td>%s</td> ", $entry);
|
---|
46 | }
|
---|
47 | printf("</tr>");
|
---|
48 | }
|
---|
49 | printf("</table>");
|
---|
50 |
|
---|
51 | mysql_free_result($result);
|
---|
52 |
|
---|
53 | mysql_close($db_id);
|
---|
54 | }
|
---|
55 | */
|
---|
56 |
|
---|
57 | function EnumQuery($name)
|
---|
58 | {
|
---|
59 | $var = $name . "Enum";
|
---|
60 | $txt = "";
|
---|
61 | switch ($_GET[$var])
|
---|
62 | {
|
---|
63 | case 0: $txt .= ""; break;
|
---|
64 | case 1: $txt .= $name . "='yes' AND "; break;
|
---|
65 | case 2: $txt .= $name . "='no' AND "; break;
|
---|
66 | case 3: $txt .= ""; break;
|
---|
67 | }
|
---|
68 | return $txt;
|
---|
69 | }
|
---|
70 |
|
---|
71 | function PrintEnumMenu($name, $text)
|
---|
72 | {
|
---|
73 | $var = $name . "Enum";
|
---|
74 |
|
---|
75 | if ($_GET[$name]=="On")
|
---|
76 | $checked = "checked";
|
---|
77 | else
|
---|
78 | $checked = "";
|
---|
79 |
|
---|
80 | printf(" <input type=\"checkbox\" name=\"%s\" value=\"On\" %s>%s\n", $name, $checked, $text);
|
---|
81 | printf("<BR>");
|
---|
82 |
|
---|
83 | printf(" <select name=\"%s\">\n", $var);
|
---|
84 |
|
---|
85 | $status = array
|
---|
86 | ( 0 => "all",
|
---|
87 | 1 => "yes",
|
---|
88 | 2 => "no",
|
---|
89 | 3 => "group by"
|
---|
90 | );
|
---|
91 |
|
---|
92 | $stat=$_GET[$var];
|
---|
93 | for ($i=0; $i<4; $i++)
|
---|
94 | {
|
---|
95 | if ($stat==$i)
|
---|
96 | printf("<option value=\"%d\" selected>%s</option>\n", $i, $status[$i]);
|
---|
97 | else
|
---|
98 | printf("<option value=\"%d\">%s</option>\n", $i, $status[$i]);
|
---|
99 | }
|
---|
100 |
|
---|
101 | printf(" </select>\n");
|
---|
102 | printf(" \n");
|
---|
103 |
|
---|
104 | }
|
---|
105 |
|
---|
106 | function StatusQuery($name, $needs)
|
---|
107 | {
|
---|
108 | $var = $name . "Status";
|
---|
109 | $txt = "";
|
---|
110 | switch ($_GET[$var])
|
---|
111 | {
|
---|
112 | case 0: $txt .= ""; break;
|
---|
113 | case 1: $txt .= "NOT (IsNull(" . $name . ") OR " . $name . "='1970-01-01 00:00:00') AND "; break;
|
---|
114 | case 2: $txt .= "IsNull(" . $name . ") AND IsNull(fStartTime) AND IsNull(fFailedTime) AND NOT IsNull(" . $needs[$name] . ") AND "; break;
|
---|
115 | case 3: $txt .= $name ."='1970-01-01 00:00:00' AND "; break;
|
---|
116 | case 4: $txt .= " (IsNull(" . $name . ") AND IsNull(fFailedTime) AND NOT IsNull(fStartTime) AND date_sub(Now(),interval 12 hour) < fStartTime AND NOT IsNull(" . $needs[$name] . ")) AND "; break;
|
---|
117 | case 5: $txt .= " (IsNull(" . $name . ") AND NOT IsNull(fFailedTime) AND NOT IsNull(fStartTime) AND NOT IsNull(" . $needs[$name] . ")) AND "; break;
|
---|
118 | case 6: $txt .= " (IsNull(" . $name . ") AND IsNull(fFailedTime) AND NOT IsNull(fStartTime) AND date_sub(Now(),interval 12 hour) > fStartTime AND NOT IsNull(" . $needs[$name] . ")) AND "; break;
|
---|
119 | // case 6: $txt .= "crashed"; break;
|
---|
120 | case 7: $txt .= ""; break;
|
---|
121 | }
|
---|
122 | return $txt;
|
---|
123 | }
|
---|
124 |
|
---|
125 | function PrintStatusMenu($name, $text)
|
---|
126 | {
|
---|
127 | $var = $name . "Status";
|
---|
128 |
|
---|
129 | if ($_GET[$name]=="On")
|
---|
130 | $checked = "checked";
|
---|
131 | else
|
---|
132 | $checked = "";
|
---|
133 |
|
---|
134 | printf(" <input type=\"checkbox\" name=\"%s\" value=\"On\" %s>%s\n", $name, $checked, $text);
|
---|
135 | printf("<BR>");
|
---|
136 |
|
---|
137 | printf(" <select name=\"%s\">\n", $var);
|
---|
138 |
|
---|
139 | $status = array
|
---|
140 | ( 0 => "all",
|
---|
141 | 1 => "done",
|
---|
142 | 2 => "not done",
|
---|
143 | 3 => "not to be done",
|
---|
144 | 4 => "running",
|
---|
145 | 5 => "failed",
|
---|
146 | 6 => "crashed",
|
---|
147 | 7 => "group by",
|
---|
148 | );
|
---|
149 |
|
---|
150 | $stat=$_GET[$var];
|
---|
151 | for ($i=0; $i<8; $i++)
|
---|
152 | {
|
---|
153 | if ($stat==$i)
|
---|
154 | printf("<option value=\"%d\" selected>%s</option>\n", $i, $status[$i]);
|
---|
155 | else
|
---|
156 | printf("<option value=\"%d\">%s</option>\n", $i, $status[$i]);
|
---|
157 | }
|
---|
158 |
|
---|
159 | /*
|
---|
160 | $status = array("all", "done", "not done", "not to be done");
|
---|
161 | $counter = 0;
|
---|
162 | foreach ($status as $element)
|
---|
163 | {
|
---|
164 | if ($counter==$_GET[$var])
|
---|
165 | printf("<option value=\"%d\" selected>%3s</option>\n", $counter++, $element);
|
---|
166 | else
|
---|
167 | printf("<option value=\"%d\">%3s</option>\n", $counter++, $element);
|
---|
168 | }*/
|
---|
169 | printf(" </select>\n");
|
---|
170 | printf(" \n");
|
---|
171 |
|
---|
172 | }
|
---|
173 |
|
---|
174 | function PrintLimitsMenu($limits, $rms, $alias)
|
---|
175 | {
|
---|
176 | foreach($limits as $key => $element)
|
---|
177 | {
|
---|
178 | printf("<tr><td>%s</td>\n", $alias[$key]);
|
---|
179 | $mean=$key . "Mean";
|
---|
180 | $limitmean=$_GET[$mean];
|
---|
181 | printf("<td><input name=\"%sMean\" type=\"text\" size=\"6\" maxlength=\"6\" value=\"%s\"></td>\n", $key, $limitmean);
|
---|
182 | if ($rms[$key]=="yes")
|
---|
183 | {
|
---|
184 | $rms2=$key . "Rms";
|
---|
185 | $limitrms=$_GET[$rms2];
|
---|
186 | printf("<td><input name=\"%sRms\" type=\"text\" size=\"6\" maxlength=\"6\" value=\"%s\"></td>\n", $key, $limitrms);
|
---|
187 | }
|
---|
188 | else
|
---|
189 | printf("<td><br></td>\n");
|
---|
190 | printf("</tr>\n");
|
---|
191 | }
|
---|
192 |
|
---|
193 | }
|
---|
194 |
|
---|
195 | function PrintPullDown($db, $table, $name, $index, $descr)
|
---|
196 | {
|
---|
197 | $db_id = mysql_connect("hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");
|
---|
198 | if ($db_id==FALSE)
|
---|
199 | {
|
---|
200 | printf("mysql_connect returned the following error:<br>");
|
---|
201 | printf("%s<br>", mysql_error());
|
---|
202 | die("");
|
---|
203 | }
|
---|
204 |
|
---|
205 | $query = "SELECT " . $index . ", " . $name . " FROM " . $db . "." . $table . " ORDER BY " . $name;
|
---|
206 | $result = mysql_query($query);
|
---|
207 |
|
---|
208 | if (!$result)
|
---|
209 | {
|
---|
210 | printf("-N/A-");
|
---|
211 | return;
|
---|
212 | }
|
---|
213 |
|
---|
214 | $numrows = mysql_num_rows($result);
|
---|
215 |
|
---|
216 | if ($_GET[$name]=="On")
|
---|
217 | $checked = "checked";
|
---|
218 | else
|
---|
219 | $checked = "";
|
---|
220 |
|
---|
221 | printf(" <input type=\"checkbox\" name=\"%s\" value=\"On\" %s><A HREF=\"printtable.php?fTable=%s\">%s</A>\n", $name, $checked, $table, $descr);
|
---|
222 |
|
---|
223 | printf(" <BR>\n");
|
---|
224 |
|
---|
225 | printf(" <select name=\"%s\" size=\"1\" class=\"Width\">\n", $index);
|
---|
226 |
|
---|
227 | if (empty($_GET[$index]) || $_GET[$index]==0)
|
---|
228 | printf(" <option value=\"0\" selected>--- ALL ---</option>\n");
|
---|
229 | else
|
---|
230 | printf(" <option value=\"0\">--- ALL ---</option>\n");
|
---|
231 |
|
---|
232 | if (!empty($_GET[$index]) && $_GET[$index]==-1)
|
---|
233 | printf(" <option value=\"-1\" selected>--- GROUP BY ---</option>\n");
|
---|
234 | else
|
---|
235 | printf(" <option value=\"-1\">--- GROUP BY ---</option>\n");
|
---|
236 |
|
---|
237 | while ($row = mysql_fetch_row($result))
|
---|
238 | {
|
---|
239 | if (!empty($_GET[$index]) && $_GET[$index]==$row[0])
|
---|
240 | printf(" <option value=\"%s\" selected>%s</option>\n", $row[0], $row[1]);
|
---|
241 | else
|
---|
242 | printf(" <option value=\"%s\">%s</option>\n", $row[0], $row[1]);
|
---|
243 | }
|
---|
244 | printf(" </select>\n");
|
---|
245 | printf(" \n", $index);
|
---|
246 |
|
---|
247 | mysql_free_result($result);
|
---|
248 |
|
---|
249 | mysql_close($db_id);
|
---|
250 | }
|
---|
251 |
|
---|
252 | function GetMin($field, $table, $db)
|
---|
253 | {
|
---|
254 | $db_id = mysql_connect("hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");
|
---|
255 | if ($db_id==FALSE)
|
---|
256 | {
|
---|
257 | printf("mysql_connect returned the following error:<br>");
|
---|
258 | printf("%s<br>", mysql_error());
|
---|
259 | die("");
|
---|
260 | }
|
---|
261 |
|
---|
262 | $query = "SELECT MIN(" . $field . ") FROM " . $db . "." . $table;
|
---|
263 | $result = mysql_query($query);
|
---|
264 | if (!$result)
|
---|
265 | return "0";
|
---|
266 |
|
---|
267 | $row = mysql_fetch_row($result);
|
---|
268 |
|
---|
269 | $min = $row[0];
|
---|
270 |
|
---|
271 | mysql_free_result($result);
|
---|
272 | mysql_close($db_id);
|
---|
273 |
|
---|
274 | return $min;
|
---|
275 | }
|
---|
276 |
|
---|
277 | function GetMax($field, $table, $db)
|
---|
278 | {
|
---|
279 | $db_id = mysql_connect("hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");
|
---|
280 | if ($db_id==FALSE)
|
---|
281 | {
|
---|
282 | printf("mysql_connect returned the following error:<br>");
|
---|
283 | printf("%s<br>", mysql_error());
|
---|
284 | die("");
|
---|
285 | }
|
---|
286 |
|
---|
287 | $query = "SELECT MAX(" . $field . ") FROM " . $db . "." . $table;
|
---|
288 | $result = mysql_query($query);
|
---|
289 | if (!$result)
|
---|
290 | return "0";
|
---|
291 |
|
---|
292 | $row = mysql_fetch_row($result);
|
---|
293 |
|
---|
294 | $max = $row[0];
|
---|
295 |
|
---|
296 | mysql_free_result($result);
|
---|
297 | mysql_close($db_id);
|
---|
298 |
|
---|
299 | return $max;
|
---|
300 | }
|
---|
301 | /*
|
---|
302 | function GetMin()
|
---|
303 | {
|
---|
304 | $db_id = mysql_connect("hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");
|
---|
305 | if ($db_id==FALSE)
|
---|
306 | {
|
---|
307 | printf("mysql_connect returned the following error:<br>");
|
---|
308 | printf("%s<br>", mysql_error());
|
---|
309 | die("");
|
---|
310 | }
|
---|
311 |
|
---|
312 | $query = "SELECT MIN(fRunNumber) FROM MyMagic.RunData";
|
---|
313 | $result = mysql_query($query);
|
---|
314 | if (!$result)
|
---|
315 | return "0";
|
---|
316 |
|
---|
317 | $row = mysql_fetch_row($result);
|
---|
318 |
|
---|
319 | $min = $row[0];
|
---|
320 |
|
---|
321 | mysql_free_result($result);
|
---|
322 | mysql_close($db_id);
|
---|
323 |
|
---|
324 | return $min;
|
---|
325 | }
|
---|
326 |
|
---|
327 | function GetMax()
|
---|
328 | {
|
---|
329 | $db_id = mysql_connect("hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");
|
---|
330 | if ($db_id==FALSE)
|
---|
331 | {
|
---|
332 | printf("mysql_connect returned the following error:<br>");
|
---|
333 | printf("%s<br>", mysql_error());
|
---|
334 | die("");
|
---|
335 | }
|
---|
336 |
|
---|
337 | $query = "SELECT MAX(fRunNumber) FROM MyMagic.RunData";
|
---|
338 | $result = mysql_query($query);
|
---|
339 | if (!$result)
|
---|
340 | return "0";
|
---|
341 |
|
---|
342 | $row = mysql_fetch_row($result);
|
---|
343 |
|
---|
344 | $max = $row[0];
|
---|
345 |
|
---|
346 | mysql_free_result($result);
|
---|
347 | mysql_close($db_id);
|
---|
348 |
|
---|
349 | return $max;
|
---|
350 | }
|
---|
351 | */
|
---|
352 |
|
---|
353 | function PrintText($result0)
|
---|
354 | {
|
---|
355 | header("Content-type: application/octet");
|
---|
356 | header("Content-Disposition: attachment; filename=query-result.txt");
|
---|
357 |
|
---|
358 | while ($row0 = mysql_fetch_assoc($result0))
|
---|
359 | {
|
---|
360 | foreach ($row0 as $key => $element)
|
---|
361 | printf("%s\t", $element);
|
---|
362 | printf("\n");
|
---|
363 | }
|
---|
364 | }
|
---|
365 |
|
---|
366 | function Checkbox($value, $text)
|
---|
367 | {
|
---|
368 | if ($_GET[$value]=="On")
|
---|
369 | $checked = "checked";
|
---|
370 | else
|
---|
371 | $checked = "";
|
---|
372 |
|
---|
373 | printf(" <td><input type=\"checkbox\" name=\"%s\" value=\"On\" %s>%s</td>\n", $value, $checked, $text);
|
---|
374 | }
|
---|
375 |
|
---|
376 | function CheckWhere($column, $_GET)
|
---|
377 | {
|
---|
378 | foreach ($_GET as $key => $element)
|
---|
379 | {
|
---|
380 | if ($key==$column)
|
---|
381 | {
|
---|
382 | if ($element>0)
|
---|
383 | printf ("FIXED: %s<BR>", $column);
|
---|
384 | return $element;
|
---|
385 | }
|
---|
386 | }
|
---|
387 | return 0;
|
---|
388 | }
|
---|
389 |
|
---|
390 | function CheckGroup($column, $_GET)
|
---|
391 | {
|
---|
392 | foreach ($_GET as $key => $element)
|
---|
393 | {
|
---|
394 | if ($key==$column)
|
---|
395 | {
|
---|
396 | //if ($element==-1)
|
---|
397 | // printf ("GROUP: %s<BR>", $column);
|
---|
398 | return $element;
|
---|
399 | }
|
---|
400 | }
|
---|
401 | return 0;
|
---|
402 | }
|
---|
403 |
|
---|
404 | function CheckStatusGroup($column, $_GET)
|
---|
405 | {
|
---|
406 | foreach ($_GET as $key => $element)
|
---|
407 | if ($key==$column)
|
---|
408 | if ($element==7)
|
---|
409 | return -1;
|
---|
410 | return 0;
|
---|
411 | }
|
---|
412 |
|
---|
413 | function CheckEnumGroup($column, $_GET)
|
---|
414 | {
|
---|
415 | foreach ($_GET as $key => $element)
|
---|
416 | if ($key==$column)
|
---|
417 | if ($element==3)
|
---|
418 | return -1;
|
---|
419 | return 0;
|
---|
420 | }
|
---|
421 |
|
---|
422 | function CreateMenu($rows)
|
---|
423 | {
|
---|
424 | $menu = "";
|
---|
425 |
|
---|
426 | if (empty($_GET["fNumResults"]))
|
---|
427 | return;
|
---|
428 |
|
---|
429 | if ($_GET["fNumStart"]!=0)
|
---|
430 | {
|
---|
431 | $uri = $_SERVER["REQUEST_URI"];
|
---|
432 | $pos = strpos($uri, "fNumStart");
|
---|
433 | $amp3=FALSE;
|
---|
434 | if ($pos!=FALSE)
|
---|
435 | {
|
---|
436 | $amp1 = substr($uri, 0, $pos-1);
|
---|
437 | $amp2 = substr($uri, $pos);
|
---|
438 | $amp3 = strchr($amp2, "&");
|
---|
439 |
|
---|
440 | $uri = $amp1;
|
---|
441 | }
|
---|
442 | $pos = $_GET["fNumStart"]-$rows;
|
---|
443 | if ($pos<0)
|
---|
444 | $pos=0;
|
---|
445 | $uri .= "&fNumStart=" . $pos;
|
---|
446 | if ($amp3!=FALSE)
|
---|
447 | $uri .= $amp3;
|
---|
448 |
|
---|
449 | $menu .= "<A HREF='" . $uri . "'><<< Prev</A>\n";
|
---|
450 | }
|
---|
451 |
|
---|
452 | $menu .= " --- <B>";
|
---|
453 | $menu .= $_GET["fNumStart"];
|
---|
454 | $menu .= "</B> --- \n";
|
---|
455 |
|
---|
456 | if ($rows==$_GET["fNumResults"])
|
---|
457 | {
|
---|
458 | $uri = $_SERVER["REQUEST_URI"];
|
---|
459 | $pos = strpos($uri, "fNumStart");
|
---|
460 | $amp3=FALSE;
|
---|
461 | if ($pos!=FALSE)
|
---|
462 | {
|
---|
463 | $amp1 = substr($uri, 0, $pos-1);
|
---|
464 | $amp2 = substr($uri, $pos);
|
---|
465 | $amp3 = strchr($amp2, "&");
|
---|
466 |
|
---|
467 | $uri = $amp1;
|
---|
468 | }
|
---|
469 | $uri .= "&fNumStart=" . ($_GET["fNumStart"]+$rows);
|
---|
470 | if ($amp3!=FALSE)
|
---|
471 | $uri .= $amp3;
|
---|
472 |
|
---|
473 | $menu .= "<A HREF='" . $uri . "'>Next >>></A>\n";
|
---|
474 | }
|
---|
475 | return $menu;
|
---|
476 | }
|
---|
477 |
|
---|
478 | function RemoveSortBy($rows)
|
---|
479 | {
|
---|
480 | $menu = "";
|
---|
481 |
|
---|
482 | $uri = $_SERVER["REQUEST_URI"];
|
---|
483 | $pos = strpos($uri, "fSortBy");
|
---|
484 | $amp3=FALSE;
|
---|
485 | if ($pos!=FALSE)
|
---|
486 | {
|
---|
487 | $amp1 = substr($uri, 0, $pos-1);
|
---|
488 | $amp2 = substr($uri, $pos);
|
---|
489 | $amp3 = strchr($amp2, "&");
|
---|
490 |
|
---|
491 | $uri = $amp1;
|
---|
492 | }
|
---|
493 |
|
---|
494 | return $uri;
|
---|
495 | }
|
---|
496 |
|
---|
497 | function FindAlias($alias, $search)
|
---|
498 | {
|
---|
499 | foreach ($alias as $key => $element)
|
---|
500 | if ($element==$search)
|
---|
501 | return $key;
|
---|
502 |
|
---|
503 | return "";
|
---|
504 | }
|
---|
505 |
|
---|
506 | function PrintMagicTable($result0, $alias, $rightalign, $limits, $rms, $_GET)
|
---|
507 | {
|
---|
508 | $col = FALSE;
|
---|
509 | $first = TRUE;
|
---|
510 |
|
---|
511 | $menu = CreateMenu(mysql_num_rows($result0));
|
---|
512 |
|
---|
513 | printf("\n<center>\n<p>%s<P>\n", $menu);
|
---|
514 | printf("<table BORDER=\"0\">\n");
|
---|
515 | while ($row0 = mysql_fetch_assoc($result0))
|
---|
516 | {
|
---|
517 | if ($first)
|
---|
518 | {
|
---|
519 | printf(" <tr BGCOLOR='#C0C0C0'>\n");
|
---|
520 | $first = FALSE;
|
---|
521 | foreach ($row0 as $key => $element)
|
---|
522 | {
|
---|
523 | $col = FindAlias($alias, $key);
|
---|
524 |
|
---|
525 | $ord="%2B";
|
---|
526 | $issort = "";
|
---|
527 | if (!empty($_GET["fSortBy"]) && substr($_GET["fSortBy"], 0, -1)==$col)
|
---|
528 | {
|
---|
529 | if (substr($_GET["fSortBy"], -1)=="+")
|
---|
530 | {
|
---|
531 | $ord="-";
|
---|
532 | $issort=" <IMG SRC='down.gif'>";
|
---|
533 | }
|
---|
534 | else
|
---|
535 | $issort=" <IMG SRC='up.gif'>";
|
---|
536 | }
|
---|
537 | printf(" <th> <A HREF='%s&fSortBy=%s%s'>%s</A>%s </th>\n",
|
---|
538 | RemoveSortBy($_SERVER["REQUEST_URI"]), $col, $ord, $key, $issort);
|
---|
539 | }
|
---|
540 | printf(" </tr>\n\n");
|
---|
541 | }
|
---|
542 |
|
---|
543 | if (!$col)
|
---|
544 | printf(" <tr BGCOLOR='#E0E0E0'>\n");
|
---|
545 | else
|
---|
546 | printf(" <tr BGCOLOR='#D0D0D0'>\n");
|
---|
547 | $col = !$col;
|
---|
548 |
|
---|
549 | foreach ($row0 as $key => $element)
|
---|
550 | {
|
---|
551 | if (empty($rightalign[$key]))
|
---|
552 | printf(" <td align=\"left\">");
|
---|
553 | else
|
---|
554 | printf(" <td align=\"right\">");
|
---|
555 |
|
---|
556 | if (!(empty($limits) && empty($rms)))
|
---|
557 | {
|
---|
558 | foreach($limits as $key2 => $element2)
|
---|
559 | {
|
---|
560 | $mean=$key2 . "Mean";
|
---|
561 | $rms2=$key2 . "Rms";
|
---|
562 | if ($key==$alias[$element2] && !empty($_GET[$mean]))
|
---|
563 | {
|
---|
564 | if ($rms[$key2]=="yes")
|
---|
565 | {
|
---|
566 | if (!empty($_GET[$rms2]))
|
---|
567 | {
|
---|
568 | $min=$_GET[$mean] - $_GET[$rms2];
|
---|
569 | $max=$_GET[$mean] + $_GET[$rms2];
|
---|
570 | if ($min < $element && $element < $max)
|
---|
571 | printf("<font color='green'>");
|
---|
572 | else
|
---|
573 | printf("<font color='red'>");
|
---|
574 | }
|
---|
575 | }
|
---|
576 | else
|
---|
577 | {
|
---|
578 | if ($rms[$key2]=="min")
|
---|
579 | {
|
---|
580 | if ($_GET[$mean] <= $element)
|
---|
581 | printf("<font color='green'>");
|
---|
582 | else
|
---|
583 | printf("<font color='red'>");
|
---|
584 | }
|
---|
585 |
|
---|
586 | if ($rms[$key2]=="max")
|
---|
587 | {
|
---|
588 | if ($_GET[$mean] >= $element)
|
---|
589 | printf("<font color='green'>");
|
---|
590 | else
|
---|
591 | printf("<font color='red'>");
|
---|
592 | }
|
---|
593 | }
|
---|
594 | }
|
---|
595 |
|
---|
596 | }
|
---|
597 | }
|
---|
598 |
|
---|
599 | printf(" %s </td>\n", str_replace("&ws;", " ", str_replace(" ", " ", $element)));
|
---|
600 | }
|
---|
601 | printf(" </tr>\n");
|
---|
602 | }
|
---|
603 | printf("</table>\n");
|
---|
604 |
|
---|
605 | /*
|
---|
606 | $info = mysql_info();
|
---|
607 | if (!empty($info))
|
---|
608 | printf("%s<BR>\n", $info);
|
---|
609 | */
|
---|
610 |
|
---|
611 | printf("<P><B>Number of displayed results: %d</B><P><P>\n", mysql_num_rows($result0));
|
---|
612 | printf("%s\n", $menu);
|
---|
613 | printf("<P>\n");
|
---|
614 | printf("</center>\n");
|
---|
615 | printf("</tr><tr class='Block'><td>\n");
|
---|
616 | }
|
---|
617 |
|
---|
618 | ?>
|
---|