1 | <?php
|
---|
2 | {
|
---|
3 | ini_set("display_errors", "On");
|
---|
4 | ini_set("mysql.trace_mode", "On");
|
---|
5 |
|
---|
6 | if (empty($_GET["fProgram"]))
|
---|
7 | $_GET["fProgram"]="";
|
---|
8 | if (empty($_GET["fSelectSize"]))
|
---|
9 | $_GET["fSelectSize"]="10";
|
---|
10 | if (empty($_GET["fMode"]))
|
---|
11 | $_GET["fMode"]="view";
|
---|
12 |
|
---|
13 | include("db.php");
|
---|
14 | $db_id = mysql_pconnect($host, $user, $pw);
|
---|
15 | if ($db_id==FALSE)
|
---|
16 | {
|
---|
17 | printf("mysql_connect returned the following error: %s\n", mysql_error());
|
---|
18 | die("");
|
---|
19 | }
|
---|
20 | mysql_select_db($db);
|
---|
21 |
|
---|
22 | $query1 = "SELECT Max(fCounter) FROM History";
|
---|
23 | $result1=mysql_query($query1, $db_id);
|
---|
24 | $row1 = mysql_fetch_row($result1);
|
---|
25 | $maxcounter=$row1[0];
|
---|
26 | mysql_free_result($result1);
|
---|
27 |
|
---|
28 | $query0 ="SELECT fProgram FROM ProgramOption ";
|
---|
29 | $query0.="WHERE fCounter=".$maxcounter." ";
|
---|
30 | $query0.="GROUP BY fProgram";
|
---|
31 | $result0=mysql_query($query0, $db_id);
|
---|
32 |
|
---|
33 | if (strcmp($_GET["fMode"], "edit")==0)
|
---|
34 | printf("select program: <br>\n");
|
---|
35 | // else
|
---|
36 | // printf("select program: \n");
|
---|
37 |
|
---|
38 | if (strcmp($_GET["fMode"], "view")==0)//reload tables in case of mode 'view'
|
---|
39 | printf("<select style='width: 120px' id='prog' size='%s' onchange='get_keys(this.value,\"\",\"%s\",\"%s\");get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");CompareValues();' class='Width'>\n",
|
---|
40 | $_GET["fSelectSize"], $_GET["fSelectSize"], $_GET["fMode"]);
|
---|
41 | else
|
---|
42 | printf("<select style='width: 120px' id='prog' size='%s' onchange=\"get_keys(this.value,'','%s','%s')\" class='Width'>\n",
|
---|
43 | $_GET["fSelectSize"], $_GET["fSelectSize"], $_GET["fMode"]);
|
---|
44 |
|
---|
45 | if (!empty($_GET["fProgram"]) && strcmp("all", $_GET["fProgram"])==0)
|
---|
46 | printf("<option value='all' selected> --- all programs --- </option>\n");
|
---|
47 | else
|
---|
48 | printf("<option value='all'> --- all programs --- </option>\n");
|
---|
49 | while ($row0 = mysql_fetch_row($result0))
|
---|
50 | if (!empty($_GET["fProgram"]) && strcmp($row0[0],$_GET["fProgram"])==0)
|
---|
51 | printf("<option value='%s' selected>%s </option>\n", $row0[0], $row0[0]);
|
---|
52 | else
|
---|
53 | printf("<option value='%s'>%s </option>\n", $row0[0], $row0[0]);
|
---|
54 | printf("</select>\n");
|
---|
55 | if (strcmp($_GET["fMode"], "edit")==0)
|
---|
56 | printf("<br>\n<button onClick='addRow(1,\"\",\"\",\"\",\"\",\"\",\"\",\"\");' id='addrowprog' style='display:inline'>Add Prg/Key</button>\n");
|
---|
57 | mysql_free_result($result0);
|
---|
58 |
|
---|
59 | mysql_close($db_id);
|
---|
60 |
|
---|
61 | ini_set("display_errors", "Off");
|
---|
62 | ini_set("mysql.trace_mode", "Off");
|
---|
63 | }
|
---|
64 | ?>
|
---|