-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathget_snmp.php
More file actions
56 lines (35 loc) · 958 Bytes
/
Copy pathget_snmp.php
File metadata and controls
56 lines (35 loc) · 958 Bytes
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
<?php
include 'vars.php';
$extra = 'index.php';
if ($table == NULL) {
$table = $_GET["olt"];
} else {
}
$ip = str_replace ("_", ".", $table);
include 'get_ro.php';
include 'get_rw.php';
include_once 'function_lib.php';
$sql_ip = ip2longfixed($ip);
$conn = mysql_connect($mysql_host, $mysql_user, $mysql_pass);
mysql_query("SET NAMES utf8");
mysql_select_db($mysql_db);
UpdateOltLastAct($conn, $sql_ip, $date);
$Array_descr = snmprealwalk($ip, $ro, ".1.3.6.1.4.1.3320.101.10.1.1.26");
if(count($Array_descr)>0)
{
foreach($Array_descr as $key => $type)
{
$key = end(explode('10.1.1.26.', $key));
$type = NameById($ip, $ro, $key);
$olt = strtok($type, ":");
if(preg_match("#:#", $type))
{
$rx = RxById($ip, $ro, $key);
$nameint = NameIntAddZero(NameById($ip, $ro, $key));
$mac = MacById($ip, $ro, $key);
UpdateOnu($conn, $sql_ip, $date, $nameint, $mac, $rx);
}
}
}
header("Location: http://$host$uri/$extra?page=olt&olt=$table");
?>