source: trunk/www/db_po/get_keys.php@ 11553

Last change on this file since 11553 was 11505, checked in by Daniela Dorner, 14 years ago
added plenty of new features to view and edit the configuration database
  • Property svn:executable set to *
File size: 2.3 KB
Line 
1<?php
2{
3 ini_set("display_errors", "On");
4 ini_set("mysql.trace_mode", "On");
5
6 if (empty($_GET["fProgram"]))
7 {
8 echo "Please select a program.<br>";
9 return;
10 }
11 if (empty($_GET["fKey"]))
12 $_GET["fKey"]="";
13 if (empty($_GET["fSelectSize"]))
14 $_GET["fSelectSize"]="10";
15 if (empty($_GET["fMode"]))
16 $_GET["fMode"]="view";
17
18 include("db.php");
19 $db_id = mysql_pconnect($host, $user, $pw);
20 if ($db_id==FALSE)
21 {
22 printf("mysql_connect returned the following error: %s\n", mysql_error());
23 die("");
24 }
25 mysql_select_db($db);
26
27 $query1 = "SELECT Max(fCounter) FROM History";
28 $result1=mysql_query($query1, $db_id);
29 $row1 = mysql_fetch_row($result1);
30 $maxcounter=$row1[0];
31 mysql_free_result($result1);
32
33 $query0="SELECT Concat(fKey1, fKey2) as ourkeys from ProgramOption ";
34 $query0.="WHERE fCounter=".$maxcounter." ";
35 if ($_GET["fProgram"]!="all")
36 $query0.="AND fProgram='".$_GET["fProgram"]."' ";
37 $query0.="GROUP BY ourkeys";
38
39 $result0=mysql_query($query0, $db_id);
40
41 if (strcmp($_GET["fMode"], "edit")==0)
42 printf("select key: <br>\n");
43 else
44 printf("select key: \n");
45 printf("<select style='width:200px' id='key' size='%s' onchange=\"get_values(1,'%s',this.value,'%s')\"class='Width'>\n",
46 $_GET["fSelectSize"], $_GET["fProgram"], $_GET["fMode"]);
47 if (!empty($_GET["fKey"]) && strcmp("all", $_GET["fKey"])==0)
48 printf("<option value='all' selected> --- all keys --- </option>\n");
49 else
50 printf("<option value='all'> --- all keys --- </option>\n");
51 while ($row0 = mysql_fetch_row($result0))
52 if (!empty($_GET["fKey"]) && strcmp($row0[0], $_GET["fKey"])==0)
53 printf("<option value='%s' selected>%s </option>\n", $row0[0], $row0[0]);
54 else
55 printf("<option value='%s'>%s </option>\n", $row0[0], $row0[0]);
56 printf("</select>\n<br>\n");
57 if (strcmp($_GET["fMode"], "edit")==0)
58 printf("<button onClick='addRow(2,\"%s\",\"\",\"\",\"\",\"\");' id='addrowkey' style='display:inline'>Add Key</button>\n", $_GET["fProgram"]);
59 mysql_free_result($result0);
60
61 mysql_close($db_id);
62
63 ini_set("display_errors", "Off");
64 ini_set("mysql.trace_mode", "Off");
65}
66?>
Note: See TracBrowser for help on using the repository browser.