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'];
$d = ORM::for_table('tbl_customers')->find_one($id);
if(empty($d['username'])){
r2(U . 'logout', 'd', '');
}
return $d;
}

View File

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

View File

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

View File

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