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 |
|
---|
46 | if (strcmp($_GET["fMode"], "view")==0)//reload tables in case of mode 'view'
|
---|
47 | printf("<select style='width:200px' id='key' size='%s' onchange='get_values(1,\"%s\",this.value,\"%s\");get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");CompareValues();' class='Width'>\n",
|
---|
48 | $_GET["fSelectSize"], $_GET["fProgram"], $_GET["fMode"]);
|
---|
49 | else
|
---|
50 | printf("<select style='width:200px' id='key' size='%s' onchange=\"get_values(1,'%s',this.value,'%s')\" class='Width'>\n",
|
---|
51 | $_GET["fSelectSize"], $_GET["fProgram"], $_GET["fMode"]);
|
---|
52 |
|
---|
53 | if (!empty($_GET["fKey"]) && strcmp("all", $_GET["fKey"])==0)
|
---|
54 | printf("<option value='all' selected> --- all keys --- </option>\n");
|
---|
55 | else
|
---|
56 | printf("<option value='all'> --- all keys --- </option>\n");
|
---|
57 | while ($row0 = mysql_fetch_row($result0))
|
---|
58 | if (!empty($_GET["fKey"]) && strcmp($row0[0], $_GET["fKey"])==0)
|
---|
59 | printf("<option value='%s' selected>%s </option>\n", $row0[0], $row0[0]);
|
---|
60 | else
|
---|
61 | printf("<option value='%s'>%s </option>\n", $row0[0], $row0[0]);
|
---|
62 | printf("</select>\n");
|
---|
63 | if (strcmp($_GET["fMode"], "edit")==0)
|
---|
64 | printf("<br>\n<button onClick='addRow(2,\"%s\",\"\",\"\",\"\",\"\",\"\",\"\");' id='addrowkey' style='display:inline'>Add Key</button>\n", $_GET["fProgram"]);
|
---|
65 | mysql_free_result($result0);
|
---|
66 |
|
---|
67 | mysql_close($db_id);
|
---|
68 |
|
---|
69 | ini_set("display_errors", "Off");
|
---|
70 | ini_set("mysql.trace_mode", "Off");
|
---|
71 | }
|
---|
72 | ?>
|
---|