-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathonu_sql.php
More file actions
130 lines (102 loc) · 3.56 KB
/
onu_sql.php
File metadata and controls
130 lines (102 loc) · 3.56 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?php
include 'ping.php';
include 'vars.php';
$extra = 'index.php';
include_once 'function_lib.php';
if ($table == NULL) {
$table = $_GET["olt"];
} else {
}
$sort = $_GET["sort"];
if ($sort == NULL) {
$sort = "name";
} else {
}
$sfp = $_GET["sfp"];
if ($sfp == NULL) {
$sort_sfp == NULL;
}
else {
$sort_sfp = "&sfp=$sfp";
}
if ($search == NULL)
{
} else {
$search_sql ="AND name LIKE \"%$search%\" OR mac LIKE \"%$search%\" OR comments LIKE \"%$search%\"";
}
$ip = str_replace ("_", ".", $table);
include 'get_ro.php';
$date = date('d.m.Y H:i:s');
$tables = $table."s";
$conn = mysql_connect($mysql_host, $mysql_user, $mysql_pass);
mysql_query("SET NAMES utf8");
mysql_select_db($mysql_db);
echo "<font size=\"3\"><table cellspacing=\"0\"><thead>";
echo "<tr><th style=\"width: 8px; padding: 0px;\"></th><th><a href=\"index.php?page=olt&olt=$ip&sort=name".$sort_sfp."\"></a></th><th><a href=\"index.php?page=olt&olt=$ip&sort=mac".$sort_sfp."\">Интерфейс/MAC ONU</a></th><th><a
href=\"index.php?page=olt&olt=$ip&sort=comments".$sort_sfp."\">Описание</a></th><th><a href=\"index.php?page=olt&olt=$ip&sort=pwr".$sort_sfp."\">Бюджет</a></th><th><a href=\"index.php?page=olt&olt=$ip&sort=last_activity".$sort_sfp."\">Посл. активность</a></th><th>Unbind ONU</th></tr></thead>";
if ($sort == "pwr") {
$sort="CAST(last_pwr AS DECIMAL(3,1)) DESC";
}
$ip_sql = sprintf('%u', ip2long($ip));
$sql = "select * from onus WHERE olt=\"$sql_ip\" AND name LIKE \"EPON0/$sfp%\" $search_sql ORDER BY $sort";
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
die('Could not enter data: ' . mysql_error());
}
while ($row=mysql_fetch_array($retval)) {
$nameint = $row['name'];
$mac = $row['mac'];
if ($use_userside == "yes") {
$code = $row['code'];
$type = $row['type'];
if ($code == NULL) {
$comments = $row['comments'];
} else {
include 'get_us_data.php';
include 'make_comments_by_us.php';
}
} else {
$comments = $row['comments'];
}
$pwr = $row['pwr'];
$last_pwr = $row['last_pwr'];
$last_act = $row['last_activity'];
$lat = $row['lat'];
if ($lat == NULL) {
$lat = 0;
} else {
}
$nameint = NameIntDelZero($nameint);
if ($pwr == "Offline" or $ping == 0) {
$color="red";
$cell_color = "#FF0000";
} else {
$cell_color = "#66FF11";
$color="#333333";
}
echo "<tr class=\"container\" onclick=\"document.location = '?page=onu&olt=$ip&mac=$mac';\">";
echo "<td style=\"width: 8px; padding: 0px; background: $cell_color;\"></td>";
echo "<td class=\"container\" style=\"white-space:nowrap; width: 5px; margin: 0px; padding: 0px;\">";
if ($lat == 0) {
echo "<img width=\"16\" src=\"images/marker_red.png\" title=\"Not placed on map\">";
}
else {
echo "<img width=\"16\" src=\"images/marker_green.png\" title=\"Placed on map\">";
}
echo "</td><td><div align=\"left\"><font size=\"2\"><b>$nameint</b></font><br/>$mac</div></td><td class=\"abon_name\">$comments</td>";
if ($pwr == "Offline" or $ping == 0) {
echo "<td style=\"padding:0px;\"><font color=\"red\">$last_pwr</font></td><td style=\"padding:0px;\">$last_act</td>";
} else {
echo "<td style=\"padding:0px;\">";
echo $pwr;
echo "</td><td style=\"padding:0px;\"></td>";
}
$epon_sfp = end(explode('/', $nameint));
$epon_sfp = explode(':', $epon_sfp);
$epon_sfp = $epon_sfp[0];
echo "<td style=\"width: 12px; padding:0px;\"><a href=\"index.php?page=unbind_onu&ip=$ip&mac=$mac&sfp=$epon_sfp\" onclick=\"return confirm('Отвязать ONU от OLT? ONU будет оставаться в списке этого OLT пока не будет заново обнаружена на любом изестном
OLTе')\">X</a></td></tr>";
}
?>
</table>