Fix redirect and check user in database

This commit is contained in:
Ibnu Maksum 2023-06-15 17:06:22 +07:00
parent a9d10d330f
commit 12e06a51e4
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
4 changed files with 78 additions and 76 deletions

View File

@ -10,6 +10,10 @@ class User
{ {
$id = $_SESSION['uid']; $id = $_SESSION['uid'];
$d = ORM::for_table('tbl_customers')->find_one($id); $d = ORM::for_table('tbl_customers')->find_one($id);
if(empty($d['username'])){
r2(U . 'logout', 'd', '');
}
return $d; return $d;
} }

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/) * PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
**/ **/
@ -11,6 +12,7 @@ $user = User::_info();
$ui->assign('_user', $user); $ui->assign('_user', $user);
use PEAR2\Net\RouterOS; use PEAR2\Net\RouterOS;
require_once 'system/autoload/PEAR2/Autoload.php'; require_once 'system/autoload/PEAR2/Autoload.php';
switch ($action) { switch ($action) {
@ -54,7 +56,6 @@ switch ($action) {
_log('[' . $user['username'] . ']: Password changed successfully', 'User', $user['id']); _log('[' . $user['username'] . ']: Password changed successfully', 'User', $user['id']);
r2(U . 'login'); r2(U . 'login');
} else { } else {
if (!$config['radius_mode']) { if (!$config['radius_mode']) {
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
@ -78,7 +79,6 @@ switch ($action) {
r2(U . 'login'); r2(U . 'login');
} }
} else { } else {
r2(U . 'accounts/change-password', 'e', $_L['Incorrect_Current_Password']); r2(U . 'accounts/change-password', 'e', $_L['Incorrect_Current_Password']);
} }
@ -91,15 +91,13 @@ switch ($action) {
break; break;
case 'profile': case 'profile':
$d = ORM::for_table('tbl_customers')->find_one($user['id']);
$id = $_SESSION['uid'];
$d = ORM::for_table('tbl_customers')->find_one($id);
if ($d) { if ($d) {
run_hook('customer_view_edit_profile'); #HOOK run_hook('customer_view_edit_profile'); #HOOK
$ui->assign('d', $d); $ui->assign('d', $d);
$ui->display('user-profile.tpl'); $ui->display('user-profile.tpl');
} else { } else {
r2(U . 'accounts/users', 'e', $_L['Account_Not_Found']); r2(U . 'home', 'e', $_L['Account_Not_Found']);
} }
break; break;
@ -117,8 +115,7 @@ switch ($action) {
$msg .= 'Phone Number must be a number' . '<br>'; $msg .= 'Phone Number must be a number' . '<br>';
} }
$id = _post('id'); $d = ORM::for_table('tbl_customers')->find_one($user['id']);
$d = ORM::for_table('tbl_customers')->find_one($id);
if ($d) { if ($d) {
} else { } else {
$msg .= $_L['Data_Not_Found'] . '<br>'; $msg .= $_L['Data_Not_Found'] . '<br>';

View File

@ -9,6 +9,7 @@ $ui->assign('_title', $_L['Dashboard']);
$user = User::_info(); $user = User::_info();
$ui->assign('_user', $user); $ui->assign('_user', $user);
//Client Page //Client Page
$bill = User::_billing(); $bill = User::_billing();
$ui->assign('_bill', $bill); $ui->assign('_bill', $bill);

View File

@ -22,13 +22,13 @@
</div> </div>
{if isset($notify)} {if isset($notify)}
<div class="row"> <div class="row">
<div class="col-md-6 col-md-offset-3"> <div class="col-sm-6 col-sm-offset-3">
{$notify} {$notify}
</div> </div>
</div> </div>
{/if} {/if}
<div class="row"> <div class="row">
<div class="col-md-4 col-md-offset-2"> <div class="col-sm-6 col-sm-offset-1">
<div class="panel panel-info"> <div class="panel panel-info">
<div class="panel-heading">{$_L['Announcement']}</div> <div class="panel-heading">{$_L['Announcement']}</div>
<div class="panel-body"> <div class="panel-body">
@ -36,7 +36,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col-md-4"> <div class="col-sm-4">
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading">{$_L['Sign_In_Member']}</div> <div class="panel-heading">{$_L['Sign_In_Member']}</div>
<div class="panel-body"> <div class="panel-body">