-
Notifications
You must be signed in to change notification settings - Fork 0
/
conf.php
executable file
·133 lines (121 loc) · 3.62 KB
/
conf.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?php
/*
Copyright © 2009,2015,2022 Siggi Bjarnason.
Licensed under GNU GPL v3 and later. Check out LICENSE.TXT for details
or see <https://www.gnu.org/licenses/gpl-3.0-standalone.html>
Allows for management of configuration items
*/
require("header.php");
if($strReferer != $strPageURL and $PostVarCount > 0)
{
printPg("Invalid operation, Bad Reference!!!","error");
exit;
}
printPg("Site Configuration","h1");
if(($PostVarCount == 1) and ($_POST["btnSubmit"] == "Go Back"))
{
header("Location: $strPageURL");
}
if(isset($_POST["btnSubmit"]))
{
$btnSubmit = $_POST["btnSubmit"];
}
else
{
$btnSubmit = "";
}
if($btnSubmit == "Save")
{
$strValueName = CleanSQLInput(substr(trim($_POST["txtValueName"]),0,49));
$strValue = "False";
if(isset($_POST["txtValue"]))
{
$strValue = CleanSQLInput(substr(trim($_POST["txtValue"]),0,49));
}
if(isset($_POST["chkValue"]))
{
$strValue = "True";
}
$strQuery = "update tblconf set vcValue = '$strValue' where vcValueName = '$strValueName';";
UpdateSQL($strQuery,"update");
}
print "<table>\n";
$strQuery = "SELECT * FROM tblconf where vcValueName not in ('Maintenance','ROOTPATH');";
$QueryData = QuerySQL($strQuery);
if($QueryData[0] > 0)
{
foreach($QueryData[1] as $Row)
{
$Key = $Row["vcValueName"];
$Value = $Row["vcValue"];
$ValueDescr = $Row["vcValueDescr"];
$ValueType = $Row["vcValueType"];
if($WritePriv <= $Priv)
{
print "<form method=\"POST\">\n";
print "<tr valign=\"top\">\n";
print "<td class=\"lblright\"><input type=\"hidden\" value=\"$Key\" name=\"txtValueName\">$ValueDescr: </td>\n";
print "<td>";
switch($ValueType)
{
case "Boolean":
if($Value=="True")
{
$strChecked = "checked";
}
else
{
$strChecked = "";
}
print "<input type=\"checkbox\" name=\"chkValue\" $strChecked>";
break;
case "int":
case "text":
print "<input type=\"text\" value=\"$Value\" name=\"txtValue\" size=\"50\" >";
break;
default :
print "<select size=\"1\" name=\"txtValue\">\n";
$strQuery = "SELECT vcType, vcText FROM $ValueType ORDER BY iOrder;";
$QueryData = QuerySQL($strQuery);
if($QueryData[0] > 0)
{
foreach($QueryData[1] as $Row2)
{
if($Row2["vcType"] == $Value)
{
print "<option selected value=\"{$Row2['vcType']}\">{$Row2['vcText']}</option>\n";
}
else
{
print "<option value=\"{$Row2['vcType']}\">{$Row2['vcText']}</option>\n";
}
}
}
else
{
$strMsg = Array2String($QueryData[1]);
error_log("Query of $strQuery did not return data. Rowcount: $QueryData[0] Msg:$strMsg");
printPg($ErrMsg,"error");
}
print "</select>\n";
}
print "</td>\n";
print "<td><input type=\"Submit\" value=\"Save\" name=\"btnSubmit\"></td>";
print "</tr>\n";
print "</form>\n";
}
else
{
print "$ValueDescr : $Value<br>\n";
}
}
}
else
{
$strMsg = Array2String($QueryData[1]);
error_log("Query of $strQuery did not return data. Rowcount: $QueryData[0] Msg:$strMsg");
printPg($ErrMsg,"error");
}
print "</table>\n";
require("footer.php");
?>