-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparamModifyResult.php
More file actions
107 lines (107 loc) · 3.28 KB
/
paramModifyResult.php
File metadata and controls
107 lines (107 loc) · 3.28 KB
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
<html>
<head>
<title>Parameter Modify Result</title>
<?php
include('config.php');
include_once('auditTrial.php');
include_once('parameter.php');
session_start();
include('layoutjscss.php');
?>
</head>
<body>
<div class="ui-layout-north">
<?php
include('header.php');
?>
</div>
<div class="ui-layout-west">
<?php
include('paramModifyForm.php');
?>
</div>
<div class="ui-layout-center">
<?php
if($_SERVER["REQUEST_METHOD"] == "POST") {
$formname=addslashes($_POST['formname']);
if ($formname=="paramModifyForm") {
$variable=addslashes($_POST['variable']);
if (strlen($variable)) {
// format the sql statement using the variable fields of the form
$sql="SELECT pValue, pDescription FROM tParameter WHERE pVariable='$variable'";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
if (mysql_num_rows($result)==1) {
$value = $row['pValue'];
$description = $row['pDescription'];
// format the form
echo "<meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\">";
echo "<link rel=\"stylesheet\" href=\"libs/css/astlogger.css\">";
echo "<form action=\"paramModifyResult.php\" method=\"post\">";
echo "<table>";
// hidden field
echo "<tr>";
echo "<td ></td>";
echo "<td ></td>";
echo "<td ><input name=\"pVariable\" type=\"hidden\" id=\"pVariable\" value=\"";
echo $variable;
echo "\"></td>";
echo "</tr>";
// display pVariable
echo "<tr>";
echo "<td >pVariable</td>";
echo "<td >:</td>";
echo "<td >";
echo $variable;
echo "</td>";
echo "</tr>";
// Edit pValue
echo "<tr>";
echo "<td >pValue</td>";
echo "<td >:</td>";
echo "<td><textarea name=\"pValue\" id=\"pValue\" rows=\"1\" cols=\"80\" >$value</textarea></td>";
echo "</tr>";
// Edit pDescription
echo "<tr>";
echo "<td >pDescription</td>";
echo "<td >:</td>";
echo "<td><textarea name=\"pDescription\" id=\"pDescription\" rows=\"1\" cols=\"80\" >$description</textarea></td>";
echo "</tr>";
// hidden form name
echo "<tr>";
echo "<td ></td>";
echo "<td ></td>";
echo "<td ><input name=\"formname\" type=\"hidden\" id=\"formname\" value=\"paramModifyResult\" /></td>";
echo "</tr>";
echo "<tr>";
echo "<td> </td>";
echo "<td> </td>";
echo "<td><input type=\"submit\" value=\" Modify \"></td>";
echo "</tr>";
echo "</table>";
echo "</form>";
}
}
} else if ($formname=="paramModifyResult") {
// username and password sent from Form
$variable=addslashes($_POST['pVariable']);
$value=addslashes($_POST['pValue']);
$description=addslashes($_POST['pDescription']);
if (setParameter($variable, $value, $description)) {
$_SESSION['s_systemMessage'] = "Update parameter $variable successfully.";
// audit trial
$auditTrial = "update parameter $variable successfully.";
insertAuditTrial($auditTrial);
} else {
$_SESSION['s_systemMessage'] = "Update parameter $variable failed.";
// audit trial
$auditTrial = "update parameter $variable failed.";
insertAuditTrial($auditTrial);
}
header("location: welcome.php?action=paramModify");
}
}
?>
</div>
</body>
</html>