HI,
is there any api i can get the system user detail with a single click, and can update to all authority with a api interface?
HI,
is there any api i can get the system user detail with a single click, and can update to all authority with a api interface?
If you have a programmer available, you could make such tool, we have an API:
http://wiki.mikrotik.com/wiki/Manual:API
Hi Normunds,
some little help needed:
<?php
require("routeros_api.class.php");
require_once ("functions.php");
$database="WT_iGate";
$con=connect_db();
mysql_select_db($database) or die("Unable to select database");
$cmd="SELECT * FROM site WHERE 1";
$result=mysql_query($cmd);
// $result=mysql_result($result, 0);
// echo $result;
if(mysql_num_rows($result)){
// valid package purchased
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$username = $row['username'];
$password = $row['password'];
$allowedipaddr = $row['allowedipaddr'];
\
\
$API = new routeros_api();
$API->debug = false;
if ($API->connect($allowedipaddr, $username, $password)) {
\
\
\
$API->write('/ip/address/print');
$READ = $API->read(false);
$ARRAY = $API->parse_response($READ);
print_r($ARRAY);
echo "<table style=\"width:60%\" border=\"1\">
<tr>
<th>IP Address/th>
<th>Network</th>
<th>Interface</th>
</tr>
";
\
\
$API->write('/user/print');
$READ = $API->read(false);
$ARRAY = $API->parse_response($READ);
\
\
// print_r($ARRAY);
echo "<table style=\"width:60%\" border=\"1\">
<tr>
<th>Users</th>
<th>Groups</th>
<th>Allowed Address</th>
</tr>
";
foreach ($ARRAY as $output) {
$name= $output['name'];
$group= $output['group'];
$address= $output['address'];
echo "<tr>
<td align=center width=20%>$name</td>
<td align=center width=10%>$group</td>
<td align=center width=20%>$address</td>
</tr>";
//write to change the password, if found the user, will convert to id, then use id to change the password. chaging in array session.
if($name=="bbttest"){
echo $id = $output['.id'];
$ARRAY= $API->comm("/user/set", array(".id"=>"$id","password"=>"bbtbehtahanu","group"=>"admin"));
echo "password changed";
}
}
echo "</table>";
\
\
\
$API->write('/system/routerboard/print');
$READ = $API->read(false);
$ARRAY = $API->parse_response($READ);
print_r($ARRAY);
\
\
\
\
\
\
\
$API->disconnect();
echo "<p></p>";
}
}
}
\
\
\
?>
\
\
i can have the output in the table format with no issue, but the ip address and routerboard is not able to work with this.
can help a bit on this?
if you use PHP class made by @boen_robot, he could help you, I’m sure