File: /var/www/net/pppoeremove204.php
<?php
include "routeros_api.php";
include "name.php";
$vpn = $_GET['vpn'];
$mikrotik_ip = $vpn;
#$mikrotik_ip = 'b8d00a83a70b.sn.mynetname.net';
$removepppoe = $_POST['pppoeuser'];
$checka = $_POST['checka'];
$API = new RouterosAPI();
if($API->connect($mikrotik_ip, $mikrotik_username,$mikrotik_password)){
$idname = $API->comm("/system/identity/print");
echo $idname['0']['name']."中華汽車<br>";
$removeuser = $API->comm("/ppp/secret/getall",array(
".proplist"=> ".id",
"?name" => $removepppoe,
)
);
$API->comm(
"/ppp/secret/remove",
array(
".id" => $removeuser[0][".id"],
)
);
if($checka!=0){
$removeactive = $API->comm("/ppp/active/getall",array(
".proplist"=> ".id",
"?name" => $removepppoe,
)
);
$API->comm(
"/ppp/active/remove",
array(
".id" => $removeactive[0][".id"],
)
);
}
echo $removepppoe."帳號已刪除,請透過返回查核";
}else{
echo "社區主機斷線中,請盡快搶修";
}
$API->disconnect();
?>
<html>
<style type="text/css">
.body {
font-family: Arial, sans-serif;
text-align: center;
margin: 50px;
}
</style>
<body>
<form action="indexpppoe204.php?vpn=<?php echo $_GET['vpn'];?>" method="post">
<input type="submit" value="返回">
</form>
</body>
</html>