PHP API - Add/Remove/Edit PPP user

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!!

try

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

$API->comm("/ppp/secret/set",
		  array(
			   ".id" => $arrID[0][".id"],
			   "disabled"  => "yes",
			   )
		  );

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!!!

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???

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

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

guys which php api do you use, can anyone help me with ppp ready script for monitoring/creating/disabling ppp clients ?

 
 
 $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