mirror of
https://github.com/hotspotbilling/phpnuxbill.git
synced 2025-02-24 07:26:16 +08:00
42 lines
1.6 KiB
PHP
42 lines
1.6 KiB
PHP
<?php
|
|
/**
|
|
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
|
|
* by https://t.me/ibnux
|
|
**/
|
|
|
|
/**
|
|
* used for ajax
|
|
**/
|
|
|
|
_auth();
|
|
|
|
$action = $routes['1'];
|
|
$user = User::_info();
|
|
|
|
switch ($action) {
|
|
case 'isLogin':
|
|
$bill = ORM::for_table('tbl_user_recharges')->where('id', $routes['2'])->where('username', $user['username'])->findOne();
|
|
if ($bill['type'] == 'Hotspot' && $bill['status'] == 'on') {
|
|
$dvc = Package::getDevice($d);
|
|
if (file_exists($dvc) && $_app_stage != 'demo') {
|
|
require_once $dvc;
|
|
if ((new $d['device'])->online_customer($user, $bill['routers'])) {
|
|
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>');
|
|
} else {
|
|
if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'])) {
|
|
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>');
|
|
}else{
|
|
die(Lang::T('Your account not connected to internet'));
|
|
}
|
|
}
|
|
|
|
} else {
|
|
new Exception(Lang::T("Devices Not Found"));
|
|
}
|
|
} else {
|
|
die('--');
|
|
}
|
|
break;
|
|
default:
|
|
$ui->display('404.tpl');
|
|
}
|