Files
.github
admin
docs
install
pages_template
qrcode
scan
system
autoload
cache
controllers
accounts.php
admin.php
autoload.php
autoload_user.php
bandwidth.php
callback.php
community.php
customers.php
dashboard.php
default.php
export.php
home.php
index.html
login.php
logout.php
logs.php
mail.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
search_user.php
services.php
settings.php
voucher.php
devices
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
Dockerfile
LICENSE
README.md
composer.json
config.sample.php
docker-compose.example.yml
favicon.ico
index.php
init.php
radius.php
update.php
version.json
mitrobill/system/controllers/admin.php

58 lines
2.0 KiB
PHP
Raw Normal View History

2017-03-11 02:51:06 +07:00
<?php
2022-09-17 22:34:55 +07:00
2017-03-11 02:51:06 +07:00
/**
2023-10-12 15:55:42 +07:00
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
* by https://t.me/ibnux
2022-09-17 22:34:55 +07:00
**/
2023-10-12 15:55:42 +07:00
2024-02-27 10:37:41 +07:00
if(Admin::getID()){
r2(U.'dashboard', "s", Lang::T("You are already logged in"));
2024-02-27 10:37:41 +07:00
}
2017-03-11 02:51:06 +07:00
if (isset($routes['1'])) {
$do = $routes['1'];
} else {
$do = 'login-display';
}
2022-09-17 22:34:55 +07:00
switch ($do) {
2017-03-11 02:51:06 +07:00
case 'post':
2022-09-17 22:34:55 +07:00
$username = _post('username');
$password = _post('password');
run_hook('admin_login'); #HOOK
if ($username != '' and $password != '') {
$d = ORM::for_table('tbl_users')->where('username', $username)->find_one();
if ($d) {
$d_pass = $d['password'];
if (Password::_verify($password, $d_pass) == true) {
$_SESSION['aid'] = $d['id'];
$token = Admin::setCookie($d['id']);
2022-09-17 22:34:55 +07:00
$d->last_login = date('Y-m-d H:i:s');
$d->save();
2024-02-13 13:54:01 +07:00
_log($username . ' ' . Lang::T('Login Successful'), $d['user_type'], $d['id']);
2024-03-31 21:23:19 +07:00
if ($isApi) {
if ($token) {
showResult(true, Lang::T('Login Successful'), ['token' => "a.".$token]);
} else {
showResult(false, Lang::T('Invalid Username or Password'));
}
}
2024-02-23 14:20:12 +07:00
_alert(Lang::T('Login Successful'),'success', "dashboard");
2022-09-17 22:34:55 +07:00
} else {
2024-02-13 13:54:01 +07:00
_log($username . ' ' . Lang::T('Failed Login'), $d['user_type']);
_alert(Lang::T('Invalid Username or Password').".",'danger', "admin");
2022-09-17 22:34:55 +07:00
}
} else {
_alert(Lang::T('Invalid Username or Password')."..",'danger', "admin");
2022-09-17 22:34:55 +07:00
}
} else {
_alert(Lang::T('Invalid Username or Password')."...",'danger', "admin");
2022-09-17 22:34:55 +07:00
}
2017-03-11 02:51:06 +07:00
break;
default:
2022-09-18 00:00:40 +07:00
run_hook('view_login'); #HOOK
2022-10-16 14:48:21 +07:00
$ui->display('admin-login.tpl');
2017-03-11 02:51:06 +07:00
break;
}