function mtPublicIP($host) { // Instanciate MT API call $API = new routeros_api(); $API->debug = false; // Set a default value to return if connection to MT fails $ipaddr = "0.0.0.0"; // Query Mikrotik if ($API->connect($host, 'admin', 'DataCom')) { $API->write('/ip/dhcp-client/print'); $ARRAY = $API->read(); $API->disconnect(); $ipaddr = substr($ARRAY['0']['address'], 0, -3); if ($ipaddr == "") { $API->connect($host, 'admin', 'DataCom'); $API->write('/ip/address/print'); $ARRAY = $API->read(); $API->disconnect(); foreach ($ARRAY as $addr) { if ($addr['interface'] == "ether1") { $ipaddr = substr($addr['address'], 0, -3); } } } } return $ipaddr; }
</ul> </div> <div class="panel-body panel-body-table"> <div class="table-responsive"> <table class="table table-bordered table-striped"> <thead> <tr> <th width="50%">Nombre Interfaz</th> <th width="20%">Estado</th> <th width="30%">Velocidad LAN</th> </tr> </thead> <tbody> <?php $API->write("/interface/ethernet/getall", true); $READ = $API->read(false); $ARRAY = $API->parse_response($READ); if (count($ARRAY) > 0) { // si hay mas de 1 queue. for ($x = 0; $x < count($ARRAY); $x++) { $name = sanear_string($ARRAY[$x]['name']); $speed = sanear_string($ARRAY[$x]['speed']); if ($ARRAY[$x]['running'] == "true") { $estado = "<span class='ok'>conectado</span>"; } else { $estado = "<span class='fail'>desconectado</span>"; } $datos_interface = '<tr>'; $datos_interface .= '<td>' . $name . '</td>'; $datos_interface .= '<td>' . $estado . '</td>';
?> <?php //Conectamos al CAPsMAN $IP = $_SESSION['ip']; $user = $_SESSION['user']; $password = $_SESSION['password']; $interfaz = $_SESSION['interfaz']; $API = new routeros_api(); if ($API->connect($IP, $user, $password)) { //Creamos dos array para almacenar los datos de trafico $rows = array(); $rows2 = array(); //Enviamos el comando de monitor para capturar el tráfico una vez $API->write("/interface/monitor-traffic", false); $API->write("=interface=" . $interfaz, false); $API->write("=once=", true); $READ = $API->read(false); $ARRAY = $API->parse_response($READ); //Si hay datos if (count($ARRAY) > 0) { //En rx almacenamos el trafico leido y en tx el de transmision $rx = number_format($ARRAY[0]["rx-bits-per-second"] / 1024, 1); $tx = number_format($ARRAY[0]["tx-bits-per-second"] / 1024, 1); //En el array establecemos un nombre y unos datos $rows['name'] = 'Tx'; $rows['data'][] = $tx; $rows2['name'] = 'Rx'; $rows2['data'][] = $rx; } else {
</div> </div> <div class="panel-body"> <table id="customers2" class="table datatable"> <thead> <tr> <th>Name</th> <th>Plan</th> <th>MAC</th> <th>Distribuidor</th> </tr> </thead> <tbody> <?php $API->write("/tool/user-manager/user/getall", true); $READ = $API->read(false); $ARRAY = $API->parse_response($READ); if (count($ARRAY) > 0) { // si hay mas de 1 queue. for ($x = 0; $x < count($ARRAY); $x++) { if (!empty($ARRAY[$x]['caller-id']) == "") { $mac = "Sin MAC Fija"; } else { if ($ARRAY[$x]['caller-id'] == "bind") { $mac = "Por Blindar"; } else { $mac = $ARRAY[$x]['caller-id']; } } if (!empty($ARRAY[$x]['actual-profile']) == "") {
require '/usr/local/gts/routeros_api.class.php'; $host = "172.17.10.60"; // Convert results to integer MS function convertms($resulttime) { $result1 = explode(":", $resulttime); $result2 = explode(".", $result1[2]); $msval = $result1[0] * 60 * 60 * 1000 + $result1[1] * 60 * 1000 + $result2[0] * 1000 + $result2[1]; return $msval; } // Instanciate MT API call $API = new routeros_api(); $API->debug = false; // Query Mikrotik if ($API->connect($host, 'admin', 'DataCom')) { $API->write('/interface/sstp-client/print'); $TARGET = $API->read(); $tunuser = $TARGET[0]['user']; $pingtargarr = explode(':', $TARGET[0]['connect-to']); $pingtarg = $pingtargarr[0]; echo "Ping Target: " . $pingtarg . "\n"; $API->write('/ping', false); $API->write('=address=' . $pingtarg, false); $API->write('=count=10'); $ARRAY = $API->read(); $API->disconnect(); } // Query Tunnel End point for real public ip if ($API->connect($pingtarg, 'admin', 'D@t@c0m#')) { $API->write('/ppp/active/print'); $TUNNELS = $API->read();
//DO ARRAY WITH EACH VALUE $allPortsAccessRB = explode(',', $allPortsAccessRB); //GET NUMBER OF ACCESS PORTS CR $portsAccessCR = ""; for ($cont3 = 0; $cont3 < count($estadoAccessCR); $cont3++) { $allPortsAccessCR = $estadoAccessCR[$cont3]['new-customer-vid'] . "," . $allPortsAccessCR; } //DELETE LAST COMMA if ($allPortsAccessCR[strlen($allPorts) - 1] == ",") { $allPortsAccessCR = rtrim($allPorts, ','); } //LEAVE UNIQUE VALUES WITHOUT REPEATING $allPortsAccessCR = implode(',', array_unique(explode(',', $allPortsAccessCR))); //DO ARRAY WITH EACH VALUE $allPortsAccessCR = explode(',', $allPortsAccessCR); $API->write("/interface/ethernet/monitor", false); $API->write("=numbers=" . $valores, false); $API->write("=once=", true); $READ = $API->read(false); $statusPorts = $API->parse_response($READ); //Array Colores, $colores = ["#00fff9", "#ff00e7", "#a3ff00", "#ffdc0b", "#ff4400", "#7c00ff", "#3377ff", "#ff7468", "#20e523", "#fcc512", "#9f0d0d", "#bc9ad4", "#79addd", "#e7d1e5", "#7bcf5a", "#cc8324", "#b80f12", "#0da9b0", "#eea7b9", "#1e7352", "#eee117", "#b80000", "#00137a", "#AA0078", "#3333FF", "#99FF00", "#FFCC00", "#CC0000", "#587498", "#E86850", "#FFD800", "##00FF00", "#FF0000", "#0000FF", "#FF6600", "#A16B23", "#C9341C", "#ECC5A8", "#A3CBF1", "#79BFA1", "#FB7374", "#FF9900", "#4FD5D6", "#D6E3B5", "#FFD197", "#FFFF66", "#FFC3CE", "#21B6A8", "#CDFFFF", ""]; $API->disconnect(); } //Sacar valores String TRUNK CR for ($cont = 0; $cont < count($estadoTrunkCR); $cont++) { //Concatenamos todos los puertos de trunk $puertosTrunk = $estadoTrunkCR[$cont]['tagged-ports'] . "," . $puertosTrunk; } //Eliminamos la ultima coma $rest = substr($puertosTrunk, 0, -1);
$API->write("/interface/ethernet/set", false); $API->write("=disabled=no", false); $API->write("=.id=" . $Ports[$cont]['name']); $Ports = $API->read(); $API->disconnect(); } } } for ($cont = 0; $cont < $numPorts; $cont++) { if (isset($_POST['disablePort' . $cont])) { $API = new routeros_api(); $IP = $_SESSION['ip']; $user = $_SESSION['user']; $password = $_SESSION['password']; if ($API->connect($IP, $user, $password)) { $API->write("/interface/ethernet/set", false); $API->write("=disabled=yes", false); $API->write("=.id=" . $Ports[$cont]['name']); $Ports = $API->read(); $API->disconnect(); } } } ?> <!--Boton cerrar sesión--> <?php if ($_GET['logOut'] == 'yes') { session_destroy(); header('Location:index.php'); }
$actualPort = $arrayPorts[$cont]; //Get all ports of VLAN $previousPort = $estadoTrunkCR[$cont2]['tagged-ports']; //Delete port from previousPort $finalPort = str_replace($actualPort, "", $previousPort); //Replace ,, to , if the port is deleted in the middle of string $finalPort = str_replace(',,', ",", $finalPort); //Delete the last comma if ($finalPort[strlen($finalPort) - 1] == ",") { $finalPort = rtrim($finalPort, ','); } //DELETE VLAN if last PORT if ($previousPort === $actualPort) { $API = new routeros_api(); if ($API->connect($IP, $user, $password)) { $API->write("/interface/ethernet/switch/egress-vlan-tag/remove", false); $API->write("=.id=" . $cont2); $Ports = $API->read(); $API->disconnect(); } } else { $API = new routeros_api(); if ($API->connect($IP, $user, $password)) { $API->comm("/interface/ethernet/switch/egress-vlan-tag/set", array(".id" => $cont2, "tagged-ports" => $finalPort)); $API->disconnect(); } } } } } ?>
if ($prioridad == "1/1") { $uploadCalculado = 1; } elseif ($prioridad == "4/4") { $uploadCalculado = 0.75; } elseif ($prioridad == "6/6") { $uploadCalculado = 0.5; } elseif ($prioridad == "8/8") { $uploadCalculado = 0.25; } $mask = "/32"; $upload = $download * $uploadCalculado; $bytesUpload = $upload * 1024; $bytesDownload = $download * 1024; $total_canal = $bytesUpload . "/" . $bytesDownload; $insertar = "1"; $API->write("/queue/simple/getall", false); $API->write("?target=" . $target . $mask, true); $READ = $API->read(false); $ARRAY = $API->parse_response($READ); if (count($ARRAY) > 0) { // si el nombre de usuario "ya existe" lo edito echo "Error: La IP No puede estar repetida."; } else { $API->write("/queue/simple/add", false); $API->write("=name=" . $user, false); $API->write("=target=" . $target, false); $API->write("=max-limit=" . $total_canal, false); $API->write("=limit-at=" . $total_canal, false); $API->write("=priority=" . $prioridad, false); $API->write("=place-before=" . $insertar, true); $READ = $API->read(false);
</div> </div> </div> </div> <?php for ($cont = 0; $cont < $numPorts; $cont++) { if (isset($_POST['formMaster' . $cont])) { $seleccion = $_POST['formMaster' . $cont]; $API = new routeros_api(); $IP = $_SESSION['ip']; $user = $_SESSION['user']; $password = $_SESSION['password']; if ($API->connect($IP, $user, $password)) { $API->write("/interface/ethernet/set", false); $API->write("=master-port=" . $seleccion, false); $API->write("=.id=" . $Ports[$cont]['name']); $ARRAY = $API->read(); $API->disconnect(); } } } ?> <!--Boton cerrar sesión--> <?php if ($_GET['logOut'] == 'yes') { session_destroy(); header('Location:index.php');
<div class="col-md-8"> <input type="text" id="name" name="name" class="form-control" placeholder="Nombre Completo de Cliente"> </div> </div> <div class="form-group"> <label class="col-md-4 control-label">Identificación</label> <div class="col-md-8"> <input type="text" name="no_id" id="no_id" class="form-control" placeholder="Ingrese número identificación"> </div> </div> <div class="form-group"> <label class="col-md-4 control-label">Plan</label> <div class="col-md-8"> <select name="plan" id="plan" class="control-select select"> <?php $API->write("/tool/user-manager/profile/getall", true); $READ = $API->read(false); $ARRAY = $API->parse_response($READ); if (count($ARRAY) > 0) { // si hay mas de 1 queue. for ($x = 0; $x < count($ARRAY); $x++) { //$precio = $ARRAY[$x]['price']; $plan = $ARRAY[$x]['name']; $price = $ARRAY[$x]['price']; $datos_planes = '<option value="' . $plan . '">' . $plan . '</option>'; echo $datos_planes; } } else { // si no hay ningun binding echo "No hay Ningun Plan."; }
$destinationVlan = $_POST['destinationVlan']; if (isset($_POST['submitButton'])) { $API = new routeros_api(); if ($API->connect($IP, $user, $password)) { $API->comm("/ip/firewall/filter/add", array("chain" => "forward", "action" => $permitDeny, "in-interface" => $sourceVlan, "out-interface" => $destinationVlan)); $API->disconnect(); } } for ($cont = 0; $cont < $numFirewall; $cont++) { if (isset($_POST['disableRule' . $cont])) { $API = new routeros_api(); $IP = $_SESSION['ip']; $user = $_SESSION['user']; $password = $_SESSION['password']; if ($API->connect($IP, $user, $password)) { $API->write("/ip/firewall/filter/remove", false); $API->write("=.id=" . $cont); $Ports = $API->read(); $API->disconnect(); } } } ?> <!--Boton cerrar sesión--> <?php if ($_GET['logOut'] == 'yes') { session_destroy(); header('Location:index.php'); }
<?php echo $menu; ?> <div id="main"> <div class="header"> <h1>INICIO</h1> <h2>Resumen de RouterBoard</h2> </div> <div class="content"> <h2 class="content-subhead">Información del equipo</h2> <p> <?php //Enviamos el comando $API->write("/system/identity/getall", true); //Leemos la respuesta y la mandamos a una variable $READ = $API->read(false); //Parseamos el resultado (Lo hacemos facil de leer) $ARRAY = $API->parse_response($READ); //Consulta del estado de la interfaz ?> <table class="pure-table"> <thead> <tr> <th>Nombre Equipo</th> <th>Modelo</th> <th>Serial</th> <th>CPU</th> <th>Temperatura</th> </tr>
$API = new routeros_api(); $API->debug = false; function searchString($texto, $cadena) { if (preg_match("/" . $cadena . "/", $texto)) { return true; } else { return false; } } if ($_POST['criterio'] == "") { echo "Ingrese un criterio de busqueda"; } else { $message = $_POST['criterio']; if ($API->connect(IP_MIKROTIK, USER, PASS)) { $API->write("/log/getall"); $API->write('/cancel', false); $READ = $API->read(false); $ARRAY = $API->parse_response($READ); //print_r($ARRAY); echo "<br />"; if (count($ARRAY) > 0) { for ($x = 0; $x <= count($ARRAY); $x++) { //Clasifico errores del Log. if (preg_match("/" . $message . "/i", $ARRAY[$x]["message"])) { if (searchString($ARRAY[$x]["message"], "authentication failed")) { echo "<p><strong>" . $ARRAY[$x]["time"] . "</strong> | " . $ARRAY[$x]["message"], "authentication failed" . "</p>"; } else { echo "<p><strong>" . $ARRAY[$x]["time"] . "</strong> | <span style=\"color:#666;\">" . $ARRAY[$x]["message"] . "</span></p>"; } }
<?php $usuario = "Usuario"; $rol = "Comercial"; include "../../../includes/variables.php"; include "../layouts/menu.php"; require '../apimikrotik.php'; require '../functions/funciones.php'; $API = new routeros_api(); $API->debug = false; $plan = $_REQUEST['plan']; if ($API->connect(IP_MIKROTIK, USER, PASS)) { $API->write("/tool/user-manager/user/getall", false); $API->write('?name=' . $plan, true); $READ = $API->read(false); $ARRAY = $API->parse_response($READ); if (count($ARRAY) > 0) { // si hay mas de 1 queue. for ($x = 0; $x < count($ARRAY); $x++) { //$precio = $ARRAY[$x]['price']; $price = $ARRAY[$x]['price']; echo $price; } } else { // si no hay ningun binding echo "No hay Ningun Plan."; } } else { echo "No hay conexion"; }
<?php require '/usr/local/gts/routeros_api.class.php'; $API = new routeros_api(); $API->debug = false; //Query Botruc-41 if ($API->connect('216.226.76.91', 'admin', 'P@55w0rd!')) { $API->write('/system/gps/monitor'); $API->write('=once='); $ARRAY = $API->read(); $API->write('/cancel'); $cleanlat = explode(" ", $ARRAY[0]['latitude']); $cleanlong = explode(" ", $ARRAY[0]['longitude']); $botruc41['latitude'] = $cleanlat[1] + trim($cleanlat[2], "'") / 60 + trim(trim($cleanlat[3], "'"), "'") / 3600; $botruc41['longitude'] = 0 - $cleanlong[1] - trim($cleanlong[2], "'") / 60 - trim(trim($cleanlong[3], "'"), "'") / 3600; $API->disconnect(); } //Query Botruc-40 if ($API->connect('216.226.75.139', 'admin', 'P@55w0rd!')) { $API->write('/system/gps/monitor'); $API->write('=once='); $ARRAY = $API->read(); $API->write('/cancel'); $cleanlat = explode(" ", $ARRAY[0]['latitude']); $cleanlong = explode(" ", $ARRAY[0]['longitude']); $botruc40['latitude'] = $cleanlat[1] + trim($cleanlat[2], "'") / 60 + trim(trim($cleanlat[3], "'"), "'") / 3600; $botruc40['longitude'] = 0 - $cleanlong[1] - trim($cleanlong[2], "'") / 60 - trim(trim($cleanlong[3], "'"), "'") / 3600; $API->disconnect(); } //Build device insert query $insertquery[0] = "INSERT INTO Device (accountID,deviceID,groupID,equipmentType,vehicleID,uniqueID,displayName,description,isActive,lastUpdateTime,lastInputState) VALUES ('gtg','Botruc40','lmbotruc','netmodem','Botruc40','Botruc40','Botruc40','Botruc40',1," . time() . ",40000) ON DUPLICATE KEY UPDATE groupID=VALUES(groupID),lastUpdateTime=VALUES(lastUpdateTime),displayName=VALUES(displayName),description=VALUES(description);";
<h2 style="margin: 20px;">Información General</h2> </div> <!-- PAGE CONTENT WRAPPER --> <div class="page-content-wrap"> <div class="row"><!-- Inicia Fila Row --> <div class="col-md-5"> <form role="form" id="Get_Info" action="../action/get_clients_queue.php" method="POST"> <div class="form-horizontal"> <div class="form-group"><!-- Inicia Grupo Control --> <label class="col-md-4 control-label">Escoja el Usuario</label> <div class="col-md-8"><!--Inicia Columna md-8--> <select name="Usuario" id="Usuario" class="control-select select-definido"> <!-- Traemos los Usuarios de los Queues y los imprimimos en cada option --> <?php $API->write("/queue/simple/getall", true); $READ = $API->read(false); $ARRAY = $API->parse_response($READ); if (count($ARRAY) > 0) { // si hay mas de 1 queue. for ($x = 0; $x < count($ARRAY); $x++) { $name = sanear_string($ARRAY[$x]['name']); $id_umkt = $ARRAY[$x]['.id']; $datos_queue = "<option value='{$id_umkt}'>" . $name . "</option>"; echo $datos_queue; //var_dump($ARRAY); } } else { // si no hay ningun binding echo "<option value=''>No hay ningún usuario en Queue Simple</option>"; }
$hostek = $nd_list[$i]['ipaddr']; if (!empty($nd_list['port'])) { $hostek .= ':' . $nd_list[$i]['port']; } $result = $LMS->WIFI_GetAllSignal($hostek, $nd_list[$i]['login']); if ($result) { $data = $result; } else { $data = array(); } } if ($nastype === 14) { $MT->debug = false; $MT->port = $nd_list[$i]['port']; if ($connect = $MT->connect($nd_list[$i]['ipaddr'], $nd_list[$i]['login'], $nd_list[$i]['passwd'])) { $MT->write('/interface/wireless/registration-table/print'); $result = $MT->read(); $MT->disconnect(); if ($result) { for ($k = 0; $k < sizeof($result); $k++) { if (isset($result[$k]['signal-strength']) && !empty($result[$k]['signal-strength'])) { $tab[$k]['rx_signal'] = substr($result[$k]['signal-strength'], 0, strpos($result[$k]['signal-strength'], "dBm")); } else { $tab[$k]['rx_signal'] = 0; } if (isset($result[$k]['tx-signal-strength']) && !empty($result[$k]['tx-signal-strength'])) { $tab[$k]['tx_signal'] = $result[$k]['tx-signal-strength']; } else { $tab[$k]['tx_signal'] = 0; } if (isset($result[$k]['rx-rate']) && !empty($result[$k]['rx-rate'])) {
<div class="content"> <h2 class="content-subhead">Información General</h2> <p> <table class="pure-table" ng-controller="Tablas"> <thead> <tr> <th>Nombre Cliente</th> <th>MAC CPE</th> <th>IP</th> <th>Tiempo Conexión</th> </tr> </thead> <tbody> <?php $API->write("/ppp/active/getall", true); $READ = $API->read(false); $ARRAY = $API->parse_response($READ); if (count($ARRAY) > 0) { // si hay mas de 1 queue. for ($x = 0; $x < count($ARRAY); $x++) { $name = sanear_string($ARRAY[$x]['name']); $datos_pppoe = '<tr>'; $datos_pppoe .= '<td>' . $name . '</td>'; $datos_pppoe .= '<td>' . $ARRAY[$x]['caller-id'] . '</td>'; $datos_pppoe .= '<td>' . $ARRAY[$x]['address'] . '</td>'; $datos_pppoe .= '<td>' . $ARRAY[$x]['uptime'] . '</td>'; $datos_pppoe .= '</tr>'; echo $datos_pppoe; } } else {
$API = new routeros_api(); $API->debug = false; if ($API->connect(IP_MIKROTIK, USER, PASS)) { //Creacion Usuarios PPPoE Usermanager $customer = "admin"; $name = $_POST['name']; $phone = $_POST['no_id']; $user = strtolower($_POST['user']); $password = $_POST['password']; $plan = $_POST['plan']; $perfil = "5 minutos"; $comentarios = $_POST['comentarios']; $fecha_activacion = date('Y-m-d'); if (isset($user) || isset($password) || isset($plan)) { //valido nombre usuario $API->write("/tool/user-manager/user/getall", false); $API->write('?name=' . $user, true); $READ = $API->read(false); $ARRAY = $API->parse_response($READ); //Crea usuario, customer y password if (count($ARRAY) > 0) { // si el nombre de usuario "ya existe" lo edito echo "Error: El nombre no puede estar duplicado, el proceso no termino."; } else { $API->write("/tool/user-manager/user/add", false); $API->write("=customer=" . $customer, false); $API->write("=name=" . $user, false); $API->write("=first-name=" . $name, false); $API->write("=phone=" . $phone, false); $API->write("=comment=" . "Fecha activacion " . $fecha_activacion . " - " . $comentarios, false); $API->write("=password=" . $password, true);
</ul> </div> </div> <div class="panel-body"> <table id="customers2" class="table datatable"> <thead> <tr> <th width="30%">Nombre</th> <th width="15%">IP</th> <th width="30%">Perfil</th> </tr> </thead> <tbody> <?php $API->write("/ip/hotspot/active/getall", true); $READ = $API->read(false); $ARRAY = $API->parse_response($READ); if (count($ARRAY) > 0) { // si hay mas de 1 queue. for ($x = 0; $x < count($ARRAY); $x++) { $name = sanear_string($ARRAY[$x]['user']); $datos_user_hotspot = '<tr>'; $datos_user_hotspot .= '<td>' . $name . '</td>'; $datos_user_hotspot .= '<td>' . $ARRAY[$x]['address'] . '</td>'; $datos_user_hotspot .= '<td>' . $ARRAY[$x]['login-by'] . '</td>'; $datos_user_hotspot .= '</tr>'; echo $datos_user_hotspot; } } else { // si no hay ningun binding
</div> </div> <div class="panel-body"> <table id="customers2" class="table datatable"> <thead> <tr> <th>IP</th> <th>Plan</th> <th>Tipo de IP</th> <th>Comentarios</th> </tr> </thead> <tbody> <?php $API->write("/ip/firewall/address-list/getall", true); $READ = $API->read(false); $ARRAY = $API->parse_response($READ); if (count($ARRAY) > 0) { // si hay mas de 1 queue. for ($x = 0; $x < count($ARRAY); $x++) { if ($ARRAY[$x]['dynamic'] == "false") { $tipo_list = "Estatico"; } else { $tipo_list = "Dinámico"; } if (!empty($ARRAY[$x]['comment']) == "") { $comentarios = ""; } else { $comentarios = $ARRAY[$x]['comment']; }
<?php // Email Alerts Function function email_alert($message, $subject) { system("echo '{$message}' | mail -s '{$subject}' trouble@getdatacom.com -- -f alerts@mydatacomgts.com"); } // Read old states from file $oldstate = parse_ini_file("/root/oldstatefile.txt"); // Get current states from Mikrotik require '/usr/local/gts/routeros_api.class.php'; $API = new routeros_api(); $API->debug = false; // Query Mikrotik if ($API->connect('69.1.163.102', 'admin', 'd@t@c0m#')) { $API->write('/ppp/active/print'); $ARRAY = $API->read(); $API->disconnect(); foreach ($ARRAY as $item) { $currentstate[$item['name']] = $item['caller-id']; } $savefile = ""; foreach ($currentstate as $name => $ip) { $savefile .= $name . "=" . $ip . "\n"; } file_put_contents("/root/oldstatefile.txt", $savefile); } // Compare old to new arrays $newchange = array_diff_assoc($currentstate, $oldstate); $oldchange = array_diff_assoc($oldstate, $currentstate); // Figure out changed IPs and Tunnel Ups
$API->disconnect(); } } } } } } // ELIMINAR RUTA // for ($cont = 0; $cont < count($routes); $cont++) { if (isset($_POST['disableInterfaceRouting' . $cont])) { $API = new routeros_api(); $IP = $_SESSION['ip']; $user = $_SESSION['user']; $password = $_SESSION['password']; if ($API->connect($IP, $user, $password)) { $API->write("/ip/route/remove", false); $API->write("=.id=" . $cont); $Ports = $API->read(); $API->disconnect(); } } } ?> <!--Boton cerrar sesión--> <?php if ($_GET['logOut'] == 'yes') { session_destroy(); header('Location:index.php'); } ?>