-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathunbind_onu.php
More file actions
59 lines (46 loc) · 1.18 KB
/
Copy pathunbind_onu.php
File metadata and controls
59 lines (46 loc) · 1.18 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
<?php
include 'vars.php';
$mac = $_GET["mac"];
$ip = $_GET["ip"];
$sfp = $_GET["sfp"];
include 'get_rw.php';
if ($mac == NULL) {
echo "Ошибка: не указан MAC ONU";
} else if ($sfp == NULL) {
echo "Ошибка: не указан № интерфейса";
} else {
include 'make_bdcom_mac.php';
$username = "$telnet_user";
$password = "$telnet_pass";
$con = pfsockopen($ip, 23, $errno, $errstr, 10);
$login = $username."\r\n";
fwrite($con, $login);
$pass = $password."\r\n";
fwrite($con, $pass);
$command = "enable\r\n";
sleep(1);
if ($enable_pass == NULL) {
} else {
$enable_password = "$enable_pass";
$en_pass = $enable_password."\r\n";
fwrite($con, $en_pass);
sleep(1);
}
fwrite($con, $command);
sleep(1);
fwrite($con,"\r\n");
sleep(1);
fwrite($con, "conf\r\n");
sleep(1);
$command = "int epon0/".$sfp."\r\n";
fwrite($con, $command);
sleep(1);
$command = "no epon bind-onu mac ".$bdcom_mac."\r\n";
fwrite($con, $command);
sleep(1);
fclose($con);
//Write
snmp2_set($ip, $rw, "1.3.6.1.4.1.3320.20.15.1.1.0", i, "1");
header("Location: http://$host$uri/$extra?page=olt&olt=$ip");
}
?>