-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloggerModifyResult.php
More file actions
116 lines (116 loc) · 3.5 KB
/
loggerModifyResult.php
File metadata and controls
116 lines (116 loc) · 3.5 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
108
109
110
111
112
113
114
115
116
<html>
<head>
<title>Logger Modify Result</title>
<?php
include('config.php');
include_once('auditTrial.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('loggerModifyForm.php');
?>
</div>
<div class="ui-layout-center">
<?php
if($_SERVER["REQUEST_METHOD"] == "POST") {
$formname=addslashes($_POST['formname']);
if ($formname=="loggerModifyForm") {
$ip=addslashes($_POST['ip']);
$port=addslashes($_POST['port']);
if (strlen($ip) && strlen($port)) {
// format the sql statement using the username and password fields of the form
$sql="SELECT id_srvip, id_srvport, id_description FROM t_astsrvinfo WHERE id_srvip='$ip' and id_srvport=$port";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
if (mysql_num_rows($result)==1) {
$srvip = $row['id_srvip'];
$srvport = $row['id_srvport'];
$description = $row['id_description'];
// 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=\"loggerModifyResult.php\" method=\"post\">";
echo "<table>";
// hidden item ip
echo "<tr>";
echo "<td ></td>";
echo "<td ></td>";
echo "<td ><input name=\"ip\" type=\"hidden\" id=\"ip\" value=\"";
echo $srvip;
echo "\"></td>";
echo "</tr>";
// hidden item port
echo "<tr>";
echo "<td ></td>";
echo "<td ></td>";
echo "<td ><input name=\"port\" type=\"hidden\" id=\"port\" value=\"";
echo $srvport;
echo "\"></td>";
echo "</tr>";
echo "<tr>";
echo "<td >Logger IP</td>";
echo "<td >:</td>";
echo "<td >";
echo $srvip;
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td >Logger Port</td>";
echo "<td >:</td>";
echo "<td >";
echo $srvport;
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td >Description</td>";
echo "<td >:</td>";
echo "<td><textarea name=\"description\" id=\"description\" rows=\"1\" cols=\"80\" >$description</textarea></td>";
echo "</tr>";
echo "<tr>";
echo "<td ></td>";
echo "<td ></td>";
echo "<td ><input name=\"formname\" type=\"hidden\" id=\"formname\" value=\"loggerModifyResult\" /></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 {
// ip and port sent from Form
$ip=addslashes($_POST['ip']);
$port=addslashes($_POST['port']);
$description=addslashes($_POST['description']);
$sql = "UPDATE t_astsrvinfo SET id_description='$description' WHERE id_srvip='$ip' and id_srvport=$port";
$result=mysql_query($sql);
if (mysql_affected_rows()==1) {
$_SESSION['s_systemMessage'] = "Modify logger IP:$ip Port:$port successfully.";
// audit trial
$auditTrial = "modify logger IP:$ip Port:$port successfully.";
insertAuditTrial($auditTrial);
} else {
$_SESSION['s_systemMessage'] = "Modify logger IP:$ip Port:$port failed.";
// audit trial
$auditTrial = "modify logger IP:$ip Port:$port failed.";
insertAuditTrial($auditTrial);
}
header("location: welcome.php?action=loggerModify");
}
}
?>
</div>
</body>
</html>