-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcommon.php
159 lines (137 loc) · 4.25 KB
/
common.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<?php
header('Content-Type: text/html; charset=utf-8');
print "<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">";
print "<script src=\"./jquery-3.1.1.min.js\"></script>";
?>
<script type="text/javascript" language="javascript">
$(function() {
$("#select-olt").change(function() {
$("#select-pon").load("get.php?choice=" + $("#select-olt").val());
});
});
$(function() {
$("#select-olt-2").change(function() {
$("#select-pon-2").load("get.php?choice=" + $("#select-olt-2").val());
});
});
$(function() {
$("#select-onu").change(function() {
$("#svr-template").load("get_template.php?choice=" + $("#select-onu").val() + "&olt=" + $("#select-olt").val());
});
});
$(function() {
$("#selectall").click(function () {
var checkAll = $("#selectall").prop('checked');
if (checkAll) {
$(".case").prop("checked", true);
} else {
$(".case").prop("checked", false);
}
});
});
$(function() {
$("tr#hover").hover(
function () {
$(this).css("background","#E6E6FA");
},
function () {
$(this).css("background","");
}
);
});
var getPage;
function getPage(customer_id, type) {
$('#output').html('<img src="pic/loading.gif" />');
jQuery.ajax({
url: "onu_info.php",
data: {customer_id: customer_id, type: type},
type: "POST",
success:function(data){$('#output').html(data);}
});
}
function get_graph_power(id) {
$('#output').html('<img src="pic/loading.gif" />');
jQuery.ajax({
url: "graph_power.php",
data: {id: id},
type: "GET",
success:function(data){$('#output').html(data);}
});
}
function get_graph_traffic(id) {
$('#output').html('<img src="pic/loading.gif" />');
jQuery.ajax({
url: "graph_traffic.php",
data: {id: id},
type: "GET",
success:function(data){$('#output').html(data);}
});
}
function get_graph_packets(customer_id, type) {
$('#output').html('<img src="pic/loading.gif" />');
jQuery.ajax({
url: "graph_packets.php",
data: {id: customer_id, type: type},
type: "GET",
success:function(data){$('#output').html(data);}
});
}
function graph_onu_ethernet_ports(id, port) {
$('#output').html('<img src="pic/loading.gif" />');
jQuery.ajax({
url: "graph_onu_ethernet_ports.php",
data: {id: id, port: port},
type: "GET",
success:function(data){$('#output').html(data);}
});
}
</script>
<?php
session_start();
if (!isset($_SESSION["id"])) {
header("Location: login.php");
}
$user_class = $_SESSION["type"];
$pon_dropdown = array();
function navigation() {
global $user_class;
print "<body>";
print "<center><img src=\"pic/logo.png\">";
print "<p><a href=\"index.php\">HOME</a> :: ";
print "<a href=\"customers.php\">CUSTOMERS</a> :: ";
if ($user_class >= "6") {
print "<a href=\"olt.php\">OLT</a> :: ";
print "<a href=\"pon.php\">PON PORTS</a> :: ";
print "<a href=\"onu.php\">ONU</a> :: ";
print "<a href=\"templates.php\">TEMPLATES</a> :: ";
}
print "<a href=\"graphs.php\">GRAPHS</a> :: ";
print "<a href=\"logs.php\">LOGS</a> <BR> ";
print "<a href=\"mac_trace.php\">MAC_TRACE</a> :: ";
if ($user_class == "9")
print "<a href=\"accounts.php\">ACCOUNTS</a> :: ";
print "<a href=\"logout.php\">LOGOUT</a> ";
print "</p></center>";
print "<hr style=\"width:800;height:1px\">";
}
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
function type2id($slot, $pon_port, $onu_id) {
$vif = "0001";
$slot = str_pad(decbin($slot),5, "0", STR_PAD_LEFT);
$pon_port = str_pad(decbin($pon_port), 6, "0", STR_PAD_LEFT);
$onu_id = str_pad(decbin($onu_id), 16, "0", STR_PAD_LEFT);
$big_onu_id = bindec($vif . $slot . "0" . $pon_port . $onu_id);
return $big_onu_id;
}
function type2ponid ($slot, $pon_port) {
$slot = decbin($slot);
$pon_port = str_pad(decbin($pon_port), 6, "0", STR_PAD_LEFT);
$pon_id = bindec($slot . $pon_port);
return $pon_id;
}
?>