source: tags/Mars-V0.9.4.3/datacenter/db/printtable.php

Last change on this file was 7484, checked in by Daniela Dorner, 19 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 2.1 KB
Line 
1<?php
2{
3 function PrintForm($_GET)
4 {
5 if (empty($_GET["fTable"]))
6 {
7 printf("ERROR - No table selected.\n");
8 return;
9 }
10 }
11
12 function PrintPage($html, $db, $limits, $rms)
13 {
14 if (empty($_GET["fTable"]))
15 {
16 printf("ERROR - No table selected.\n");
17 return;
18
19 }
20
21 $db_id = mysql_connect("hercules.astro.uni-wuerzburg.de", "MAGIC", "d99swMT!");
22 if ($db_id==FALSE)
23 {
24 printf("mysql_connect returned the following error: %s\n", mysql_error());
25 die("");
26 }
27 mysql_select_db($db);
28
29 $query0 = "SELECT * FROM ";
30 $query0 .= $_GET["fTable"];
31
32 $result0 = mysql_query($query0, $db_id);
33
34 if ($result0)
35 {
36 if ($html=="1")
37 {
38 $alias = array
39 (
40 );
41 $rightalign = array
42 (
43 );
44 PrintMagicTable($result0, $alias, $rightalign, "", "", $_GET);
45 }
46 else
47 PrintText($result0);
48
49 mysql_free_result($result0);
50 }
51 mysql_close($db_id);
52
53 if ($html=="1")
54 printf("<U><B>submitted query:</B></U><BR>%s<BR>", $query0);
55 }
56
57 include ("include.php");
58 include ("db.php");
59 include ("magicdefs.php");
60
61 ini_set("display_errors", "On");
62 ini_set("mysql.trace_mode", "On");
63
64 if (!empty($_GET["fSendTxt"]))
65 {
66 header("Content-type: application/octet");
67 header("Content-Disposition: attachment; filename=query-result.txt");
68
69 PrintPage("0", $db, $limits, $rms);
70 }
71 else
72 {
73 echo (file_get_contents("index-header.html"));
74
75 $environment = sizeof($_GET);
76
77 PrintForm($_GET);
78
79 if ($environment==0)
80 printf("No query submitted yet.<BR>");
81 else
82 PrintPage("1", $db, $limits, $rms);
83
84 echo (file_get_contents("index-footer.html"));
85 }
86
87 ini_set("display_errors", "Off");
88 ini_set("mysql.trace_mode", "Off");
89}
90?>
Note: See TracBrowser for help on using the repository browser.