phpnuxbill/system/controllers/home.php

39 lines
1.3 KiB
PHP
Raw Normal View History

2017-03-11 03:51:06 +08:00
<?php
2022-09-11 12:02:30 +08:00
2017-03-11 03:51:06 +08:00
/**
2022-10-16 15:50:24 +08:00
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
2022-09-11 12:02:30 +08:00
**/
2017-03-11 03:51:06 +08:00
_auth();
2022-10-13 15:00:54 +08:00
$ui->assign('_title', $_L['Dashboard']);
2017-03-11 03:51:06 +08:00
$user = User::_info();
$ui->assign('_user', $user);
2017-03-11 03:51:06 +08:00
//Client Page
$bill = User::_billing();
$ui->assign('_bill', $bill);
2023-06-15 16:26:38 +08:00
if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'])) {
$ui->assign('nux_mac', $_SESSION['nux-mac']);
$ui->assign('nux_ip', $_SESSION['nux-ip']);
if ($_GET['mikrotik'] == 'login') {
$m = Mikrotik::info($bill['routers']);
$c = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
Mikrotik::logMeIn($c, $user['username'], $user['password'], $_SESSION['nux-ip'], $_SESSION['nux-mac']);
r2(U . 'home', 's', Lang::T('Login Request successfully'));
}else if ($_GET['mikrotik'] == 'logout') {
$m = Mikrotik::info($bill['routers']);
$c = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
Mikrotik::logMeOut($c, $user['username']);
r2(U . 'home', 's', Lang::T('Logout Request successfully'));
}
}
2022-09-11 12:02:30 +08:00
$ui->assign('unpaid', ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->where('status', 1)
->find_one());
2022-09-18 01:00:40 +08:00
run_hook('view_customer_dashboard'); #HOOK
2022-09-11 12:02:30 +08:00
$ui->display('user-dashboard.tpl');