Community discussions

MikroTik App
 
Rattlehead
just joined
Topic Author
Posts: 20
Joined: Mon Mar 01, 2010 2:09 pm

EDITED: Allow User based on IP variable

Fri Mar 05, 2010 5:25 pm

Ok completely rehashing this post I have gotten the item to a point where I have a little bit more knowledge. The only problem I am having currently is the exact syntax for the command to add an IP variable to an address-list.
As you can see the variable is being called $userip and produces the ip that hits a web server. I want to add that varialbe to the access-list. The Mikrotik command via CLI is
/ip firewall address-list
add address=variable list=PublicAuthorised
<?php
require('routeros_api.class.php');
$userip = $_SERVER['REMOTE_ADDR'];		            //DHCP IP that hits Server
$API = new routeros_api();
$API->debug = true;
if ($API->connect('x.x.x.x', 'xxxxxxxxx', 'xxxxxxxxxxxxxxxx')) {
   $API->write('/interface/getall');                //This is where I am going wrong and appreciate input

   print_r($userip);				                    //Printing of IP that hits server
   $API->disconnect();
}
?>

Who is online

Users browsing this forum: tdw and 5 guests