1 | <?php
|
---|
2 | {
|
---|
3 | function CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup, $checkenumgroup)
|
---|
4 | {
|
---|
5 | $fromtable="RunData";
|
---|
6 |
|
---|
7 | $groups = 0;
|
---|
8 | foreach ($checkgroup as $element)
|
---|
9 | if ($element==-1)
|
---|
10 | $groups++;
|
---|
11 |
|
---|
12 | $statusgroups = 0;
|
---|
13 | foreach ($checkstatusgroup as $element)
|
---|
14 | if ($element==-1)
|
---|
15 | $statusgroups++;
|
---|
16 |
|
---|
17 | $enumgroups = 0;
|
---|
18 | foreach ($checkenumgroup as $element)
|
---|
19 | if ($element==-1)
|
---|
20 | $enumgroups++;
|
---|
21 |
|
---|
22 | $query0 = "SELECT ";
|
---|
23 |
|
---|
24 | if ($groups>0)
|
---|
25 | {
|
---|
26 | foreach ($checkgroup as $key => $element)
|
---|
27 | if ($element==-1)
|
---|
28 | $query0 .= $key . " as '" . $alias[$key] . "' " . ", ";
|
---|
29 | $query0 .= " COUNT(*) as 'Runs' ";
|
---|
30 | }
|
---|
31 | else
|
---|
32 | {
|
---|
33 | if ($statusgroups>0)
|
---|
34 | {
|
---|
35 | foreach ($checkstatusgroup as $key => $element)
|
---|
36 | if ($element==-1)
|
---|
37 | $query0 .= " (if(IsNull(" . $key . "), 'not done' ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', ";
|
---|
38 |
|
---|
39 | $query0 .= " count(*) as 'Runs'";
|
---|
40 |
|
---|
41 | }
|
---|
42 | else
|
---|
43 | {
|
---|
44 | if ($enumgroups>0)
|
---|
45 | {
|
---|
46 | foreach ($checkenumgroup as $key => $element)
|
---|
47 | if ($element==-1)
|
---|
48 | $query0 .= $key . " as '" . $alias[$key] . "' " . ", ";
|
---|
49 | $query0 .= " COUNT(*) as 'Runs' ";
|
---|
50 | }
|
---|
51 | else
|
---|
52 | {
|
---|
53 | $query0 .= " RunData.fRunNumber as 'RunNumber'";
|
---|
54 | if (!empty($_GET["fLinks"]))
|
---|
55 | {
|
---|
56 | $query0 .= ", CONCAT('<A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/sinope/' , DATE_FORMAT(ADDDATE(RunData.fRunStart, INTERVAL 13 HOUR), '%Y') , '/', DATE_FORMAT(ADDDATE(RunData.fRunStart, INTERVAL 13 HOUR), '%m') , '/', DATE_FORMAT(ADDDATE(RunData.fRunStart, INTERVAL 13 HOUR), '%d') , '/sinope-dat' , LPAD(CONCAT(RunData.fRunNumber , '.html'), 13,'0') , '\">dl</A>' ";
|
---|
57 | $query0 .= ", ' <A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/sinope/' , DATE_FORMAT(ADDDATE(RunData.fRunStart, INTERVAL 13 HOUR), '%Y') , '/', DATE_FORMAT(ADDDATE(RunData.fRunStart, INTERVAL 13 HOUR), '%m') , '/', DATE_FORMAT(ADDDATE(RunData.fRunStart, INTERVAL 13 HOUR), '%d') , '/sinope-cal' , LPAD(CONCAT(RunData.fRunNumber , '.html'), 13,'0') , '\">cl</A>' ";
|
---|
58 | $query0 .= ", ' <A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/sinope/' , DATE_FORMAT(ADDDATE(RunData.fRunStart, INTERVAL 13 HOUR), '%Y') , '/', DATE_FORMAT(ADDDATE(RunData.fRunStart, INTERVAL 13 HOUR), '%m') , '/', DATE_FORMAT(ADDDATE(RunData.fRunStart, INTERVAL 13 HOUR), '%d') , '/sinope-dat' , LPAD(CONCAT(RunData.fRunNumber , '.txt'), 12,'0') , '\">dt</A>' ";
|
---|
59 | $query0 .= ", ' <A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/sinope/' , DATE_FORMAT(ADDDATE(RunData.fRunStart, INTERVAL 13 HOUR), '%Y') , '/', DATE_FORMAT(ADDDATE(RunData.fRunStart, INTERVAL 13 HOUR), '%m') , '/', DATE_FORMAT(ADDDATE(RunData.fRunStart, INTERVAL 13 HOUR), '%d') , '/sinope-cal' , LPAD(CONCAT(RunData.fRunNumber , '.txt'), 12,'0') , '\">ct</A>' ";
|
---|
60 | $query0 .= ", ' <A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/callisto/' , LEFT(LPAD(CONCAT(fSequenceFirst, '.'), 9,'0'),4), '/', LPAD(CONCAT(fSequenceFirst, '/'), 9,'0'), 'callisto', LPAD(CONCAT(fSequenceFirst , '.html'), 13,'0') , '\">c</A>'";
|
---|
61 | $query0 .= ", ' <A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/star/' , LEFT(LPAD(CONCAT(fSequenceFirst, '.'), 9,'0'),4), '/', LPAD(CONCAT(fSequenceFirst, '/'), 9,'0'), 'star', LPAD(CONCAT(fSequenceFirst , '.html'), 13,'0') , '\">s</A>'";
|
---|
62 | $query0 .= ", ' <A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/sequences/' , LEFT(LPAD(CONCAT(fSequenceFirst, '.'), 9,'0'),4), '/sequence', LPAD(CONCAT(fSequenceFirst , '.txt'), 12,'0') , '\">', 'f </A>') ";
|
---|
63 | $query0 .= " as 'Links'";
|
---|
64 | }
|
---|
65 |
|
---|
66 | foreach ($_GET as $key => $element)
|
---|
67 | if ($_GET[$key]=="On")
|
---|
68 | if ($key!="fLinks")
|
---|
69 | if (empty($checkwhere[$key]) || $checkwhere[$key]==0)
|
---|
70 | $query0 .= ", " . $key . " as '" . $alias[$key] . "' ";
|
---|
71 | }
|
---|
72 | }
|
---|
73 | }
|
---|
74 |
|
---|
75 | $query0 .= " FROM RunData ";
|
---|
76 |
|
---|
77 | $query0 .= " LEFT JOIN RunProcessStatus ON RunData.fRunNumber=RunProcessStatus.fRunNumber ";
|
---|
78 | $query0 .= " LEFT JOIN DataCheck ON DataCheck.fRunNumber=RunData.fRunNumber ";
|
---|
79 | $query0 .= " LEFT JOIN RunType ON RunType.fRunTypeKEY=RunData.fRunTypeKEY ";
|
---|
80 |
|
---|
81 | foreach ($checkwhere as $key => $element)
|
---|
82 | {
|
---|
83 | if (empty($element) || $element<=0)
|
---|
84 | continue;
|
---|
85 |
|
---|
86 | if (strpos($query0, " WHERE ")==FALSE)
|
---|
87 | $query0 .= " WHERE ";
|
---|
88 | else
|
---|
89 | if ($element!=-1)
|
---|
90 | if (strrpos($query0, " AND ")!=strlen($query0)-5)
|
---|
91 | $query0 .= " AND ";
|
---|
92 |
|
---|
93 | if ($element!=-1)
|
---|
94 | $query0 .= GetCheck($fromtable, $key) . "=" . $element;
|
---|
95 | }
|
---|
96 |
|
---|
97 | if (strpos($query0, " WHERE ")==FALSE)
|
---|
98 | $query0 .= " WHERE ";
|
---|
99 | else
|
---|
100 | $query0 .= " AND ";
|
---|
101 |
|
---|
102 | $query0 .= StatusQuery("fRawFileAvail");
|
---|
103 | $query0 .= StatusQuery("fDataCheckDone");
|
---|
104 |
|
---|
105 | $query0 .= EnumQuery("fHasSignal");
|
---|
106 | $query0 .= EnumQuery("fHasPedestal");
|
---|
107 | $query0 .= EnumQuery("fHasSignalInterlaced");
|
---|
108 | $query0 .= EnumQuery("fHasPedestalInterlaced");
|
---|
109 |
|
---|
110 | if (!empty($_GET["fRunMin"]) && !empty($_GET["fRunMax"]))
|
---|
111 | $query0 .= "RunData.fRunNumber BETWEEN " . $_GET["fRunMin"] . " AND " . $_GET["fRunMax"] . " ";
|
---|
112 |
|
---|
113 | if (!empty($_GET["fSourceN"]))
|
---|
114 | $query0 .= " AND fSourceName REGEXP \"^" . $_GET["fSourceN"] . "\" ";
|
---|
115 |
|
---|
116 | if ($groups>0)
|
---|
117 | {
|
---|
118 | $query0 .= " GROUP BY ";
|
---|
119 | $num = $groups;
|
---|
120 | foreach ($checkgroup as $key => $element)
|
---|
121 | if ($element==-1)
|
---|
122 | {
|
---|
123 | $query0 .= GetCheck($fromtable,$key);
|
---|
124 | if ($num-->1)
|
---|
125 | $query0 .= ", ";
|
---|
126 | }
|
---|
127 | }
|
---|
128 |
|
---|
129 | if ($statusgroups>0)
|
---|
130 | {
|
---|
131 | $query0 .= " GROUP BY ";
|
---|
132 | $num = $statusgroups;
|
---|
133 | foreach ($checkstatusgroup as $key => $element)
|
---|
134 | if ($element==-1)
|
---|
135 | {
|
---|
136 | $query0 .= $alias[$key];
|
---|
137 | if ($num-->1)
|
---|
138 | $query0 .= ", ";
|
---|
139 | }
|
---|
140 | }
|
---|
141 |
|
---|
142 | if ($enumgroups>0)
|
---|
143 | {
|
---|
144 | $query0 .= " GROUP BY ";
|
---|
145 | $num = $enumgroups;
|
---|
146 | foreach ($checkenumgroup as $key => $element)
|
---|
147 | if ($element==-1)
|
---|
148 | {
|
---|
149 | $query0 .= $alias[$key];
|
---|
150 | if ($num-->1)
|
---|
151 | $query0 .= ", ";
|
---|
152 | }
|
---|
153 | }
|
---|
154 |
|
---|
155 | if (!empty($_GET["fSortBy"]))
|
---|
156 | {
|
---|
157 | $val=substr($_GET["fSortBy"], 0, -1);
|
---|
158 | $query0 .= " ORDER BY " . GetTable($fromtable, $val) . " ";
|
---|
159 | if (substr($_GET["fSortBy"], -1)=="-")
|
---|
160 | $query0 .= "DESC";
|
---|
161 | }
|
---|
162 |
|
---|
163 | if (empty($_GET["fSortBy"]) && $groups==0 && $statusgroups==0)
|
---|
164 | $query0 .= " ORDER BY RunData.fRunNumber ASC ";
|
---|
165 |
|
---|
166 | if (empty($_GET["fNumStart"]))
|
---|
167 | $_GET["fNumStart"]=0;
|
---|
168 |
|
---|
169 | if (empty($_GET["fSendTxt"]))
|
---|
170 | $query0 .= " LIMIT " . $_GET["fNumStart"] . ", " . $_GET["fNumResults"];
|
---|
171 |
|
---|
172 | return $query0;
|
---|
173 | }
|
---|
174 |
|
---|
175 | function InitGet($_GET)
|
---|
176 | {
|
---|
177 | // Find out whether it is the first call to the php script
|
---|
178 | $first = empty($_GET["fRunMin"]) && empty($_GET["fRunMax"]);
|
---|
179 |
|
---|
180 | if (empty($_GET["fNumResults"]))
|
---|
181 | $_GET["fNumResults"]="20";
|
---|
182 |
|
---|
183 | if (empty($_GET["fLinks"]))
|
---|
184 | $_GET["fLinks"]=$first?"On":"";
|
---|
185 |
|
---|
186 | if (empty($_GET["fSequenceFirst"]))
|
---|
187 | $_GET["fSequenceFirst"]=$first?"On":"";
|
---|
188 |
|
---|
189 | if (empty($_GET["fEvents"]))
|
---|
190 | $_GET["fEvents"]=$first?"On":"";
|
---|
191 |
|
---|
192 | if (empty($_GET["fPositionSignal"]))
|
---|
193 | $_GET["fPositionSignal"]="Off";
|
---|
194 |
|
---|
195 | if (empty($_GET["fPositionFWHM"]))
|
---|
196 | $_GET["fPositionFWHM"]="Off";
|
---|
197 |
|
---|
198 | if (empty($_GET["fHeightSignal"]))
|
---|
199 | $_GET["fHeightSignal"]="Off";
|
---|
200 |
|
---|
201 | if (empty($_GET["fHeightFWHM"]))
|
---|
202 | $_GET["fHeightFWHM"]="Off";
|
---|
203 |
|
---|
204 | if (empty($_GET["fHasSignal"]))
|
---|
205 | $_GET["fHasSignal"]=$first?"On":"";
|
---|
206 |
|
---|
207 | if (empty($_GET["fHasSignalEnum"]))
|
---|
208 | $_GET["fHasSignalEnum"]="0";
|
---|
209 |
|
---|
210 | if (empty($_GET["fHasPedestal"]))
|
---|
211 | $_GET["fHasPedestal"]=$first?"On":"";
|
---|
212 |
|
---|
213 | if (empty($_GET["fHasPedestalEnum"]))
|
---|
214 | $_GET["fHasPedestalEnum"]="0";
|
---|
215 |
|
---|
216 | if (empty($_GET["fPositionAsym"]))
|
---|
217 | $_GET["fPositionAsym"]="Off";
|
---|
218 |
|
---|
219 | if (empty($_GET["fHeightAsym"]))
|
---|
220 | $_GET["fHeightAsym"]="Off";
|
---|
221 |
|
---|
222 | if (empty($_GET["fEventsInterlaced"]))
|
---|
223 | $_GET["fEventsInterlaced"]=$first?"On":"";
|
---|
224 |
|
---|
225 | if (empty($_GET["fPositionSignalInterlaced"]))
|
---|
226 | $_GET["fPositionSignalInterlaced"]="Off";
|
---|
227 |
|
---|
228 | if (empty($_GET["fPositionFWHMInterlaced"]))
|
---|
229 | $_GET["fPositionFWHMInterlaced"]="OFf";
|
---|
230 |
|
---|
231 | if (empty($_GET["fHeightSignalInterlaced"]))
|
---|
232 | $_GET["fHeightSignalInterlaced"]="Off";
|
---|
233 |
|
---|
234 | if (empty($_GET["fHeightFWHMInterlaced"]))
|
---|
235 | $_GET["fHeightFWHMInterlaced"]="Off";
|
---|
236 |
|
---|
237 | if (empty($_GET["fHasSignalInterlaced"]))
|
---|
238 | $_GET["fHasSignalInterlaced"]=$first?"On":"";
|
---|
239 |
|
---|
240 | if (empty($_GET["fHasSignalInterlacedEnum"]))
|
---|
241 | $_GET["fHasSignalInterlacedEnum"]="0";
|
---|
242 |
|
---|
243 | if (empty($_GET["fHasPedestalInterlaced"]))
|
---|
244 | $_GET["fHasPedestalInterlaced"]=$first?"On":"";
|
---|
245 |
|
---|
246 | if (empty($_GET["fHasPedestalInterlacedEnum"]))
|
---|
247 | $_GET["fHasPedestalInterlacedEnum"]="0";
|
---|
248 |
|
---|
249 | if (empty($_GET["fPositionAsymInterlaced"]))
|
---|
250 | $_GET["fPositionAsymInterlaced"]="Off";
|
---|
251 |
|
---|
252 | if (empty($_GET["fHeightAsymInterlaced"]))
|
---|
253 | $_GET["fHeightAsymInterlaced"]="Off";
|
---|
254 |
|
---|
255 | if (empty($_GET["fRunTypeName"]))
|
---|
256 | $_GET["fRunTypeName"]=$first?"On":"";
|
---|
257 |
|
---|
258 | if (empty($_GET["fDataCheckDone"]))
|
---|
259 | $_GET["fDataCheckDone"]="Off";
|
---|
260 |
|
---|
261 | if (empty($_GET["fDataCheckDoneStatus"]))
|
---|
262 | $_GET["fDataCheckDoneStatus"]="1";
|
---|
263 |
|
---|
264 | if (empty($_GET["fRawFileAvail"]))
|
---|
265 | $_GET["fRawFileAvail"]="Off";
|
---|
266 |
|
---|
267 | if (empty($_GET["fRawFileAvailStatus"]))
|
---|
268 | $_GET["fRawFileAvailStatus"]="1";
|
---|
269 |
|
---|
270 | }
|
---|
271 |
|
---|
272 | function PrintForm($_GET, $db)
|
---|
273 | {
|
---|
274 | printf("<center>\n");
|
---|
275 | printf("<form action=\"datacheck.php\" METHOD=\"GET\">\n");
|
---|
276 | printf(" <table>\n");
|
---|
277 | printf(" <tr>\n");
|
---|
278 |
|
---|
279 | CheckBox("fLinks", "Links");
|
---|
280 | CheckBox("fEvents", "DataEvents");
|
---|
281 | CheckBox("fEventsInterlaced", "CalEvents");
|
---|
282 | CheckBox("fSequenceFirst", "Sequence#");
|
---|
283 |
|
---|
284 | printf(" </tr><tr>\n");
|
---|
285 |
|
---|
286 | CheckBox("fPositionSignal", "ArrTime");
|
---|
287 | CheckBox("fPositionFWHM", "ArrTimeFWHM");
|
---|
288 | CheckBox("fPositionSignalInterlaced", "ArrTimeCal");
|
---|
289 | CheckBox("fPositionFWHMInterlaced", "ArrTimeFWHMCal");
|
---|
290 |
|
---|
291 | printf(" </tr><tr>\n");
|
---|
292 |
|
---|
293 | CheckBox("fHeightSignal", "Signal");
|
---|
294 | CheckBox("fPositionFWHM", "SignalFWHM");
|
---|
295 | CheckBox("fHeightSignalInterlaced", "SignalCal");
|
---|
296 | CheckBox("fPositionFWHMInterlaced", "SignalFWHMCal");
|
---|
297 |
|
---|
298 | printf(" </tr><tr>\n");
|
---|
299 |
|
---|
300 | CheckBox("fPositionAsym", "ArrTimeAsym");
|
---|
301 | CheckBox("fHeightAsym", "SignalAsym");
|
---|
302 | CheckBox("fPositionAsymInterlaced", "ArrTimeAsymCal");
|
---|
303 | CheckBox("fHeightAsymInterlaced", "SignalAsymCal");
|
---|
304 |
|
---|
305 | printf(" </tr><tr><td>\n");
|
---|
306 |
|
---|
307 | PrintEnumMenu("fHasSignal", "HasSignal");
|
---|
308 | printf(" </td><td>\n");
|
---|
309 | PrintEnumMenu("fHasPedestal", "HasPedestal");
|
---|
310 | printf(" </td><td>\n");
|
---|
311 | PrintEnumMenu("fHasSignalInterlaced", "HasSignalCal");
|
---|
312 | printf(" </td><td>\n");
|
---|
313 | PrintEnumMenu("fHasPedestalInterlaced", "HasPedestalCal");
|
---|
314 |
|
---|
315 | printf(" </td></tr><tr><td>\n");
|
---|
316 |
|
---|
317 | PrintStatusMenu("fDataCheckDone", "DataCheck");
|
---|
318 | printf(" </td><td>\n");
|
---|
319 | PrintStatusMenu("fRawFileAvail", "RawFile");
|
---|
320 | printf("</td><td>\n");
|
---|
321 |
|
---|
322 | PrintPullDown($db, "RunType", "fRunTypeName", "fRunTypeKEY", "Run Type");
|
---|
323 |
|
---|
324 | printf(" </td></tr>\n");
|
---|
325 | printf(" </table>\n");
|
---|
326 | printf(" <p>\n");
|
---|
327 |
|
---|
328 | if (empty($_GET["fRunMin"]))
|
---|
329 | $min = GetMin("fRunNumber", "RunData", $db);
|
---|
330 | else
|
---|
331 | $min = $_GET["fRunMin"];
|
---|
332 |
|
---|
333 | if (empty($_GET["fRunMax"]))
|
---|
334 | $max = GetMax("fRunNumber", "RunData", $db);
|
---|
335 | else
|
---|
336 | $max = $_GET["fRunMax"];
|
---|
337 |
|
---|
338 | /*
|
---|
339 | printf("Date (yyyy-mm-dd) <input name=\"fDate\" type=\"text\" size=\"10\" maxlength=\"10\" value=\"");
|
---|
340 | if (!empty($_GET["fDate"]))
|
---|
341 | printf("%s", $_GET["fDate"]);
|
---|
342 | printf("\"> \n");
|
---|
343 | */
|
---|
344 |
|
---|
345 | printf("DataCheck from <input name=\"fRunMin\" type=\"text\" size=\"6\" maxlength=\"6\" value=\"%s\">\n", $min);
|
---|
346 | printf("to <input name=\"fRunMax\" type=\"text\" size=\"6\" maxlength=\"6\" value=\"%s\"> \n", $max);
|
---|
347 |
|
---|
348 | printf(" <P>\n");
|
---|
349 |
|
---|
350 | printf(" Results:\n");
|
---|
351 | printf(" <select name=\"fNumResults\">\n");
|
---|
352 |
|
---|
353 | $numres = array("10", "20", "50", "100", "200", "500");
|
---|
354 | foreach ($numres as $element)
|
---|
355 | {
|
---|
356 | if ($element==$_GET["fNumResults"])
|
---|
357 | printf("<option value=\"%s\" selected>%3s</option>\n", $element, $element);
|
---|
358 | else
|
---|
359 | printf("<option value=\"%s\">%3s</option>\n", $element, $element);
|
---|
360 | }
|
---|
361 | printf(" </select>\n");
|
---|
362 | printf(" \n");
|
---|
363 |
|
---|
364 | ini_set("mysql.trace_mode", "Off");
|
---|
365 | ini_set("display_errors", "Off");
|
---|
366 |
|
---|
367 | printf("<input class='Width' type='submit' value='Query Table'> \n");
|
---|
368 | printf("<input class='Width' type='button' value='Reset' onClick='self.location.href=\"datacheck.php\"'> \n");
|
---|
369 | if (strchr($_SERVER["REQUEST_URI"], '?')!=FALSE)
|
---|
370 | printf("<input class='Width' type='button' value='Get .txt' onClick='self.location.href=\"%s&fSendTxt=1\"'> \n", $_SERVER["REQUEST_URI"]);
|
---|
371 | if (strchr($_SERVER["REQUEST_URI"], '?')!=FALSE)
|
---|
372 | printf("<input class='Width' type='button' value='Print' onClick='self.location.href=\"%s&fPrintTable=1\"'> \n", $_SERVER["REQUEST_URI"]);
|
---|
373 | printf("</form>\n");
|
---|
374 | printf("</center>\n");
|
---|
375 | printf("</td>\n");
|
---|
376 | printf("</tr>\n");
|
---|
377 | printf("<tr class='Block'>\n");
|
---|
378 | printf("<td>\n");
|
---|
379 | }
|
---|
380 |
|
---|
381 | function PrintPage($html, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $checkenumgroup)
|
---|
382 | {
|
---|
383 | $db_id = mysql_connect("hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");
|
---|
384 | if ($db_id==FALSE)
|
---|
385 | {
|
---|
386 | printf("mysql_connect returned the following error: %s\n", mysql_error());
|
---|
387 | die("");
|
---|
388 | }
|
---|
389 | mysql_select_db($db);
|
---|
390 |
|
---|
391 | $query0 = CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup, $checkenumgroup);
|
---|
392 |
|
---|
393 | $result0 = mysql_query($query0, $db_id);
|
---|
394 |
|
---|
395 | if ($result0)
|
---|
396 | {
|
---|
397 | if ($html=="1" || $html=="2")
|
---|
398 | PrintMagicTable($result0, $alias, $rightalign, "", "", $_GET);
|
---|
399 | else
|
---|
400 | PrintText($result0);
|
---|
401 |
|
---|
402 | mysql_free_result($result0);
|
---|
403 | }
|
---|
404 | mysql_close($db_id);
|
---|
405 |
|
---|
406 | if ($html=="1")
|
---|
407 | printf("<U><B>submitted query:</B></U><BR>%s<BR>", htmlspecialchars($query0));
|
---|
408 | }
|
---|
409 |
|
---|
410 | include ("include.php");
|
---|
411 | include ("db.php");
|
---|
412 | include ("magicdefs.php");
|
---|
413 |
|
---|
414 | ini_set("display_errors", "On");
|
---|
415 | ini_set("mysql.trace_mode", "On");
|
---|
416 |
|
---|
417 | if (!empty($_GET["fSendTxt"]))
|
---|
418 | {
|
---|
419 | header("Content-type: application/octet");
|
---|
420 | header("Content-Disposition: attachment; filename=query-result.txt");
|
---|
421 |
|
---|
422 | PrintPage("0", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $checkenumgroup);
|
---|
423 | }
|
---|
424 | else
|
---|
425 | {
|
---|
426 | echo (file_get_contents("index-header.html"));
|
---|
427 |
|
---|
428 | $environment = sizeof($_GET);
|
---|
429 |
|
---|
430 | InitGet($_GET);
|
---|
431 | if (empty($_GET["fPrintTable"]))
|
---|
432 | PrintForm($_GET, $db);
|
---|
433 |
|
---|
434 | if ($environment==0)
|
---|
435 | printf("No query submitted yet.<BR>");
|
---|
436 | else
|
---|
437 | {
|
---|
438 | if (empty($_GET["fPrintTable"]))
|
---|
439 | PrintPage("1", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $checkenumgroup);
|
---|
440 | else
|
---|
441 | PrintPage("2", $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $checkenumgroup);
|
---|
442 | }
|
---|
443 |
|
---|
444 | echo (file_get_contents("index-footer.html"));
|
---|
445 | }
|
---|
446 |
|
---|
447 | ini_set("display_errors", "Off");
|
---|
448 | ini_set("mysql.trace_mode", "Off");
|
---|
449 | }
|
---|
450 | ?>
|
---|