Files
.github
admin
install
pages_template
qrcode
system
autoload
cache
controllers
accounts.php
admin.php
autoload.php
autoload_user.php
bandwidth.php
callback.php
codecanyon.php
community.php
customers.php
dashboard.php
default.php
export.php
home.php
index.html
login.php
logout.php
logs.php
map.php
message.php
order.php
page.php
pages.php
paymentgateway.php
plan.php
plugin.php
pluginmanager.php
pool.php
radius.php
register.php
reports.php
routers.php
services.php
settings.php
voucher.php
lan
paymentgateway
plugin
uploads
vendor
.htaccess
api.php
boot.php
composer.json
composer.lock
cron.php
cron_reminder.php
index.html
orm.php
updates.json
ui
.gitignore
.htaccess_firewall
CHANGELOG.md
LICENSE
README.md
composer.json
config.sample.php
favicon.ico
index.php
init.php
update.php
version.json
mitrobill/system/controllers/autoload_user.php

38 lines
1.4 KiB
PHP
Raw Normal View History

2023-06-15 15:26:38 +07:00
<?php
2023-10-12 15:55:42 +07:00
/**
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
* by https://t.me/ibnux
**/
2023-06-15 15:26:38 +07:00
/**
* used for ajax
**/
_auth();
$action = $routes['1'];
$user = User::_info();
switch ($action) {
case 'isLogin':
2023-11-15 11:45:29 +07:00
$bill = ORM::for_table('tbl_user_recharges')->where('id', $routes['2'])->where('username', $user['username'])->findOne();
2023-06-15 15:26:38 +07:00
if ($bill['type'] == 'Hotspot' && $bill['status'] == 'on') {
$m = Mikrotik::info($bill['routers']);
$client = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
if (Mikrotik::isUserLogin($client, $user['username'])) {
2023-11-15 11:49:03 +07:00
die('<a href="' . U . 'home&mikrotik=logout&id='.$bill['id'].'" onclick="return confirm(\''.Lang::T('Disconnect Internet?').'\')" class="btn btn-success btn-xs btn-block">'.Lang::T('You are Online, Logout?').'</a>');
2023-06-15 15:26:38 +07:00
} else {
if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'])) {
2023-11-15 11:49:03 +07:00
die('<a href="' . U . 'home&mikrotik=login&id='.$bill['id'].'" onclick="return confirm(\''.Lang::T('Connect to Internet?').'\')" class="btn btn-danger btn-xs btn-block">'.Lang::T('Not Online, Login now?').'</a>');
2023-06-15 15:26:38 +07:00
}else{
die(Lang::T('Your account not connected to internet'));
}
}
} else {
die('--');
}
break;
default:
2023-09-27 15:01:48 +07:00
$ui->display('404.tpl');
2023-06-15 15:26:38 +07:00
}