Community discussions

MikroTik App
 
ehrasta
just joined
Topic Author
Posts: 3
Joined: Mon Aug 28, 2017 12:20 pm

disable "login by trial" with api

Sat Feb 03, 2018 7:29 pm

Hi
I'm using php with api to control my router
how can I disable " Login By Trial " in hotspot server profile using api ?
Thanks
 
kangarie
just joined
Posts: 24
Joined: Mon Apr 17, 2017 7:28 am

Re: disable "login by trial" with api

Sat Feb 03, 2018 8:07 pm

this is my code from controller codeigniter
public function on() {
	$this->load->library('routerOS');
	$router = new routerOS();
	$router->connect("192.168.202.7","tunnel","12345");

	$rows = $router->comm("/ip/hotspot/profile/getall");

	foreach($rows as $row) {
		if($row['name'] == 'default') {
			$query = $router->comm('/ip/hotspot/profile/set', 
			array('.id' => $row['.id'], 'login-by'=>'http-chap,http-pap,trial'));
		}
	}
}

public function off() {
	$this->load->library('routerOS');
	$router = new routerOS();
	$router->debug=1;
	$router->connect("192.168.202.7","tunnel","12345");

	$rows = $router->comm("/ip/hotspot/profile/getall");

	foreach($rows as $row) {
		if($row['name'] == 'default') {
			$query = $router->comm('/ip/hotspot/profile/set', 
			array('.id' => $row['.id'], 'login-by'=>'http-chap,http-pap'));
		}
	}
}

Who is online

Users browsing this forum: No registered users and 28 guests