Community discussions

MikroTik App
 
hermeson
just joined
Topic Author
Posts: 21
Joined: Wed Apr 05, 2017 1:57 am

PHP API - Add/Remove/Edit PPP user

Tue Aug 08, 2017 6:05 pm

Hi guys, finally I got in to this forum, I have been few weeks saying that I couldn't register.. anyway

Could some help me to find out what I am doing wrong on this code?

/ppp secret set [find name=hermeson] disabled=yes

I tried:
$API->write('/ppp/secret/set '.$user.' =disabled=yes');
then
$API->write('/ppp/secret/set',false);
$API->write($user,false);
$API->write('=disabled=yes');
then
$API->write('/ppp/secret/set',false);
$API->write('='.$user,false);
$API->write('=disabled=yes');
To add user it is working cool!!! but disable it, nothing.. and soon change profile (edit profile then revome active user)

3 days non-sleeping looking for a code... damn!!!

cheers!!
 
flysky
just joined
Posts: 2
Joined: Wed Aug 09, 2017 9:18 am

Re: PHP API - Add/Remove/Edit PPP user

Wed Aug 09, 2017 9:33 am

try
$arrID=$API->comm("/ppp/secret/getall", 
	              array(
		          ".proplist"=> ".id",
		          "?name" => $user,
		          ));

$API->comm("/ppp/secret/set",
		  array(
			   ".id" => $arrID[0][".id"],
			   "disabled"  => "yes",
			   )
		  );
 
hermeson
just joined
Topic Author
Posts: 21
Joined: Wed Apr 05, 2017 1:57 am

Re: PHP API - Add/Remove/Edit PPP user

Wed Aug 09, 2017 2:01 pm

fu.. yeaaahhhh... work perfectly.... man!!! where can I find this kind of language? Mikrotik should let us know this kind of programming language, coz all examples I have found did not work. do u have any manual with those commands?

Thanks a lot!!!!
 
hermeson
just joined
Topic Author
Posts: 21
Joined: Wed Apr 05, 2017 1:57 am

Re: PHP API - Add/Remove/Edit PPP user

Wed Aug 09, 2017 2:51 pm

As I could understand... the script do not work with user as name, but you always have to find the id then work on the id of client right????
 
hermeson
just joined
Topic Author
Posts: 21
Joined: Wed Apr 05, 2017 1:57 am

Re: PHP API - Add/Remove/Edit PPP user

Wed Aug 09, 2017 4:55 pm

Hu Flysky,

I tried this
$arrID=$API->comm("/ppp/secret/getall", 
                 array(
                ".proplist"=> ".id",
                "?name" => $user,
                ));

$API->comm("/ppp/active/remove",
        array(
            ".id" => $arrID[0][".id"],
            )
        );		
and it didn't work, but instead to active I put secret it does... anything especial to remove the active user??

thanks
 
hermeson
just joined
Topic Author
Posts: 21
Joined: Wed Apr 05, 2017 1:57 am

Re: PHP API - Add/Remove/Edit PPP user

Wed Aug 09, 2017 5:16 pm

I fouuuuuuuuuuuuuuuuund it LOL

I need to change secret to active when it search for a user....
$arrID=$API->comm("/ppp/active/getall", 
                 array(
                ".proplist"=> ".id",
                "?name" => $user,
                ));

$API->comm("/ppp/active/remove",
        array(
            ".id" => $arrID[0][".id"],
            )
        );	
VERYYY COOL!! leave it here for other to learn too!!!

Obrigado
 
shkelqimkoka
just joined
Posts: 15
Joined: Thu Oct 05, 2017 7:32 am

Re: PHP API - Add/Remove/Edit PPP user

Wed Aug 08, 2018 3:38 pm

guys which php api do you use, can anyone help me with ppp ready script for monitoring/creating/disabling ppp clients ?
 
User avatar
seriousblack
newbie
Posts: 36
Joined: Tue Apr 03, 2018 4:02 am
Contact:

Re: PHP API - Add/Remove/Edit PPP user

Sat Jan 02, 2021 5:02 pm

 
 
 $client = zero_says
 
 $wofBIT=$API->comm("/ppp/active/getall",
                    array(
                           ".proplist"=> ".id",
                                 "?name" => $client,
                              ));
                              
            $API->comm("/ppp/active/remove",
                  array(
                           ".id" => $wofBIT[0][".id"],
                           )
                  );

That works for me

Who is online

Users browsing this forum: No registered users and 18 guests