diff --git a/system/autoload/Mikrotik.php b/system/autoload/Mikrotik.php index f0ddcd44..bf28ad51 100644 --- a/system/autoload/Mikrotik.php +++ b/system/autoload/Mikrotik.php @@ -514,4 +514,37 @@ class Mikrotik ->setArgument('message', $message); $client->sendSync($smsRequest); } + + public static function addIpToAddressList($client, $ip, $listName, $comment = '') + { + global $_app_stage; + if ($_app_stage == 'demo') { + return null; + } + $addRequest = new RouterOS\Request('/ip/firewall/address-list/add'); + $client->sendSync( + $addRequest + ->setArgument('address', $ip) + ->setArgument('comment', $comment) + ->setArgument('list', $listName) + ); + } + + public static function removeIpFromAddressList($client, $ip) + { + global $_app_stage; + if ($_app_stage == 'demo') { + return null; + } + $printRequest = new RouterOS\Request( + '/ip firewall address-list print .proplist=.id', + RouterOS\Query::where('address', $ip) + ); + $id = $client->sendSync($printRequest)->getProperty('.id'); + $removeRequest = new RouterOS\Request('/ip/firewall/address-list/remove'); + $client->sendSync( + $removeRequest + ->setArgument('numbers', $id) + ); + } } diff --git a/system/cron.php b/system/cron.php index be5b42e6..3b022413 100644 --- a/system/cron.php +++ b/system/cron.php @@ -153,7 +153,7 @@ foreach ($d as $ds) { echo "plan enabled: $p[enabled] | User balance: $c[balance] | price $p[price]\n"; echo "auto renewall Failed\n"; Message::sendTelegram("FAILED RENEWAL #cron\n\n#u$c[username] #buy #Hotspot \n" . $p['name_plan'] . - "\nRouter: " . $router_name . + "\nRouter: " . $p['routers'] . "\nPrice: " . $p['price']); } } else { @@ -208,7 +208,7 @@ foreach ($d as $ds) { echo "plan enabled: $p[enabled] | User balance: $c[balance] | price $p[price]\n"; echo "auto renewall Failed\n"; Message::sendTelegram("FAILED RENEWAL #cron\n\n#u$c[username] #buy #PPPOE \n" . $p['name_plan'] . - "\nRouter: " . $router_name . + "\nRouter: " . $p['routers'] . "\nPrice: " . $p['price']); } }