Perbaikan di register, uptime limit dan kuota

This commit is contained in:
Ibnu Maksum
2017-03-24 13:26:14 +07:00
parent 5069d1228d
commit 2d82051895
37 changed files with 191 additions and 147 deletions

View File

@ -1,6 +1,6 @@
<?php
/**
* PHP Mikrotik Billing (www.phpmixbill.com)
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
@ -73,12 +73,58 @@ switch($do){
} catch (Exception $e) {
die('Unable to connect to the router.');
}
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
$client->sendSync($addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
if($p['typebp']=="Limited"){
if($p['limit_type']=="Time_Limit"){
if($p['time_unit']=='Hrs')
$timelimit = $p['time_limit'].":00:00";
else
$timelimit = "00:".$p['time_limit'].":00";
$client->sendSync($addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
}else if($p['limit_type']=="Data_Limit"){
if($p['data_unit']=='GB')
$datalimit = $p['data_limit']."000000000";
else
$datalimit = $p['data_limit']."000000";
$client->sendSync($addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
}else if($p['limit_type']=="Both_Limit"){
if($p['time_unit']=='Hrs')
$timelimit = $p['time_limit'].":00:00";
else
$timelimit = "00:".$p['time_limit'].":00";
if($p['data_unit']=='GB')
$datalimit = $p['data_limit']."000000000";
else
$datalimit = $p['data_limit']."000000";
$client->sendSync($addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
}else{
$client->sendSync($addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
$d = ORM::for_table('tbl_user_recharges')->create();
$d->customer_id = $user;