1 | <?php
|
---|
2 | {
|
---|
3 | ini_set("display_errors", "On");
|
---|
4 | ini_set("mysql.trace_mode", "On");
|
---|
5 |
|
---|
6 | if (empty($_GET["fKey"]))
|
---|
7 | {
|
---|
8 | echo "Please select a key.<br>";
|
---|
9 | return;
|
---|
10 | }
|
---|
11 | if (empty($_GET["fProgram"]))
|
---|
12 | {
|
---|
13 | echo "Please select a program.<br>";
|
---|
14 | return;
|
---|
15 | }
|
---|
16 |
|
---|
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 | $maxcount=$row1[0];
|
---|
31 | //echo $maxcount;
|
---|
32 |
|
---|
33 | $query0 ="SELECT fIndex, fProgram, fKey, fValue, fDescription, fCounter FROM ProgramOption ";
|
---|
34 | $query0.="WHERE fKey='".$_GET["fKey"]."'";
|
---|
35 | if ($_GET["fProgram"]!="all")
|
---|
36 | $query0.="AND fProgram='".$_GET["fProgram"]."' ";
|
---|
37 |
|
---|
38 | $result0=mysql_query($query0, $db_id);
|
---|
39 |
|
---|
40 | printf("<td valign='top'>Please edit:</td>\n");
|
---|
41 | printf("<td>\n");
|
---|
42 | printf("<button onClick='ShowCurrent();' id='showcurrent' style='display:none'>Show Current</button>\n");
|
---|
43 | printf("<button onClick='ShowAll();' id='showall' style='display:inline'>Show All</button>\n");
|
---|
44 | printf("<button onClick='addRow(\"%s\",\"%s\");' id='addrow' style='display:inline'>Add Row</button>\n", $_GET["fProgram"], $_GET["fKey"]);
|
---|
45 | printf("<table border='1' width='100px' height='100px'><tbody id='valtable'>\n");
|
---|
46 | printf("<tr><th>Index / Counter</th><th>Program</th><th>Key</th><th>Value</th><th>Description</th>");
|
---|
47 | printf("<th>Action</th></tr>\n");
|
---|
48 | while ($row0 = mysql_fetch_row($result0))
|
---|
49 | {
|
---|
50 | if ($row0[5]==$maxcount)
|
---|
51 | printf("<tr id='new%s' style='display:'>\n", $row0[0]);
|
---|
52 | else
|
---|
53 | printf("<tr id='old%s' style='display:none'>\n", $row0[0]);
|
---|
54 | printf("<td> %s / %s</td>\n", $row0[0], $row0[5]);
|
---|
55 | printf("<td id='prog%s'>%s</td>\n", $row0[0], $row0[1]);
|
---|
56 | printf("<td id='key%s'>%s</td>\n", $row0[0], $row0[2]);
|
---|
57 | printf("<td align='right' id='val%s'>%s</td>\n", $row0[0], $row0[3]);
|
---|
58 | printf("<td id='descr%s'>%s</td>\n", $row0[0], $row0[4]);
|
---|
59 | if ($row0[5]==$maxcount)
|
---|
60 | printf("<td id='action%s'><input type='button' value='Edit' onclick='EditRow(\"%s\")'></td>\n</tr>\n", $row0[0], $row0[0]);
|
---|
61 | else
|
---|
62 | printf("<td id='action%s'></td>\n</tr>\n", $row0[0]);
|
---|
63 | $maxindex=$row0[0];
|
---|
64 | }
|
---|
65 | printf("<div id='addline'></div>");
|
---|
66 | printf("</tbody></table>\n<br>\n");
|
---|
67 | printf("<div id='maxindex' style='display:none'>%s</div>\n", $maxindex);
|
---|
68 | printf("</td>\n");
|
---|
69 |
|
---|
70 | mysql_free_result($result0);
|
---|
71 |
|
---|
72 | mysql_close($db_id);
|
---|
73 |
|
---|
74 | ini_set("display_errors", "Off");
|
---|
75 | ini_set("mysql.trace_mode", "Off");
|
---|
76 | }
|
---|
77 | ?>
|
---|