este es el codigo que el cual procesa el formulario editar el cual tiene la api del equipo incluida
Código PHP:
Ver original<?php require_once('../../../../Connections/agregarequipos.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
}
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ?
intval($theValue) : "NULL"; break;
case "double":
$theValue = ($theValue != "") ?
doubleval($theValue) : "NULL"; break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); }
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form")) { $updateSQL = sprintf("UPDATE clientes SET nombres=%s, ip=%s, mac=%s, cell=%s, direcion=%s, comentario=%s, categoria=%s, pago_total=%s, fecha_inicial=%s, fecha_final=%s, codigo=%s, dias_p=%s, disable=%s, apellido=%s WHERE id=%s", GetSQLValueString($_POST['nombres'], "text"),
GetSQLValueString($ip = $_POST['ip'], "text"),
GetSQLValueString($mac = $_POST['mac'], "text"),
GetSQLValueString($_POST['cell'], "text"),
GetSQLValueString($_POST['direcion'], "text"),
GetSQLValueString($_POST['comentario'], "text"),
GetSQLValueString($_POST['categoria'], "text"),
GetSQLValueString($_POST['pago_total'], "text"),
GetSQLValueString($_POST['fecha_inicial'], "text"),
GetSQLValueString($fecha_final = $_POST['fecha_final'], "text"),
GetSQLValueString($_POST['codigo'], "text"),
GetSQLValueString($_POST['dias_p'], "text"),
GetSQLValueString($_POST['disable'], "text"),
GetSQLValueString($_POST['apellido'], "text"),
GetSQLValueString($_POST['id'], "int"));
}
$colname_Recordset1 = "-1";
if (isset($_GET['nombres'])) { $colname_Recordset1 = $_GET['nombres'];
}
$query_Recordset1 = sprintf("SELECT * FROM clientes WHERE nombres = %s", GetSQLValueString
($colname_Recordset1, "text"));
require('../../api/routeros_api.class.php');
require('../../../../Connections/miktik.php');
$API = new RouterosAPI();
$API->debug = true;
$API->connect($ipRB , $Username , $clave, $api_puerto);
$BRIDGEINFO2 = $API->comm('/ip/arp/print', array( ".proplist" => ".id",
"?address" => "$ip",
));
$API->comm("/ip/arp/set", array( ".id"=>$BRIDGEINFO2[0]['.id'],
"address" => "$ip",
"mac-address" => "$mac",
"comment" => "$fecha_final",
));
{
$BRIDGEINFO2 = $API->comm('/ip/dhcp-server/lease/print', array( ".proplist" => ".id",
"?address" => "$ip"
));
$API->comm("/ip/dhcp-server/lease/set", array( ".id"=>$BRIDGEINFO2[0]['.id'],
"address" => $ip,
"always-broadcast" => "yes",
"use-src-mac" => "yes",
"mac-address" => $mac,
"comment" => $fecha_final,
));
$disable = $_POST['disable'];
$BRIDGEINFO2 = $API->comm('/ip/arp/print', array( ".proplist" => ".id",
"?address" => "$ip"
));
$API->comm("/ip/arp/set", array( ".id"=>$BRIDGEINFO2[0]['.id'],
"disabled" => "$disable"
));
$API->disconnect();
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0;url=../../../../index.php">
<title>PlayCenter Universal</title>
<script language="javascript">
window.location.href = "../../../../index.php"
</script>
</head>
<body>
Go to <a href="../../../../index.php">index.php</a>
</body>
</html>
le tengo un redirecionamiento para no dejar en la pantalla todo los codigos de la api del equipo