Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php /** * @copyright Copyright (c) 2024 */ declare (strict_types = 1); namesp..
Decoded Output download
<?php
/**
* @copyright Copyright (c) 2024
*/
declare (strict_types = 1);
namespace appase;
use thinkacade\Cache;
use thinkacade\Db;
use thinkacade\Request;
use thinkacade\Session;
use thinkacade\View;
use systematic\Systematic;
/**
*
*/
abstract class BaseController
{
/**
*
* @var bool
*/
protected $batchValidate = false;
/**
*
* @var string
*/
protected $pageSize = 20;
/**
*
* @var array
*/
protected $middleware = [];
/**
*
* @access public
* @param App $app
*/
public function __construct()
{
$this->module = strtolower(app('http')->getName());
$this->controller = strtolower(Request::controller());
$this->action = strtolower(Request::action());
$this->uid = 0;
$this->did = 0;
$this->pid = 0;
//
$this->initialize();
}
//
protected function initialize()
{
//
$this->checkLogin();
//
$this->pageSize = Request::param('limit', hinkacade\Config::get('app.page_size'));
}
/**
*
*/
protected function checkLogin()
{
if ($this->controller !== 'login' && $this->controller !== 'captcha') {
$session_admin = get_config('app.session_admin');
if (!Session::has($session_admin)) {
if (request()->isAjax()) {
return to_assign(404, '');
} else {
redirect('/home/login/index.html')->send();
exit;
}
} else {
$this->uid = Session::get($session_admin);
$login_admin = get_admin($this->uid);
$this->did = $login_admin['did'];
$this->pid = $login_admin['pid'];
$is_lock = $login_admin['is_lock'];
if($is_lock==1){
redirect('/home/login/lock.html')->send();
exit;
}
View::assign('login_admin', $login_admin);
//
if ($this->module == 'home' && $this->controller == 'index') {
return true;
}
else{
$regPwd = $login_admin['reg_pwd'];
if($regPwd!==''){
redirect('/home/index/edit_password.html')->send();
exit;
}
if (!$this->checkAuth()) {
if (request()->isAjax()) {
return to_assign(405, ',');
} else {
redirect('/home/index/role')->send();
exit;
}
}
}
}
}
}
/**
*
* @DateTime 2020-12-21
* @param string $controller
* @param string $action
* @return [type]
*/
protected function checkAuth()
{
//Cache::delete('RulesSrc' . $uid);
$uid = $this->uid;
$GOUGU = new Systematic();
$GOUGU->auth($uid);
$auth_list_all = Cache::get('RulesSrc0');
$auth_list = Cache::get('RulesSrc' . $uid);
$pathUrl = $this->module . '/' . $this->controller . '/' . $this->action;
if (!in_array($pathUrl, $auth_list)) {
return false;
} else {
return true;
}
}
}
?>
Did this file decode correctly?
Original Code
<?php
/**
* @copyright Copyright (c) 2024
*/
declare (strict_types = 1);
namespace app\base;
use think\facade\Cache;
use think\facade\Db;
use think\facade\Request;
use think\facade\Session;
use think\facade\View;
use systematic\Systematic;
/**
*
*/
abstract class BaseController
{
/**
*
* @var bool
*/
protected $batchValidate = false;
/**
*
* @var string
*/
protected $pageSize = 20;
/**
*
* @var array
*/
protected $middleware = [];
/**
*
* @access public
* @param App $app
*/
public function __construct()
{
$this->module = strtolower(app('http')->getName());
$this->controller = strtolower(Request::controller());
$this->action = strtolower(Request::action());
$this->uid = 0;
$this->did = 0;
$this->pid = 0;
//
$this->initialize();
}
//
protected function initialize()
{
//
$this->checkLogin();
//
$this->pageSize = Request::param('limit', \think\facade\Config::get('app.page_size'));
}
/**
*
*/
protected function checkLogin()
{
if ($this->controller !== 'login' && $this->controller !== 'captcha') {
$session_admin = get_config('app.session_admin');
if (!Session::has($session_admin)) {
if (request()->isAjax()) {
return to_assign(404, '');
} else {
redirect('/home/login/index.html')->send();
exit;
}
} else {
$this->uid = Session::get($session_admin);
$login_admin = get_admin($this->uid);
$this->did = $login_admin['did'];
$this->pid = $login_admin['pid'];
$is_lock = $login_admin['is_lock'];
if($is_lock==1){
redirect('/home/login/lock.html')->send();
exit;
}
View::assign('login_admin', $login_admin);
//
if ($this->module == 'home' && $this->controller == 'index') {
return true;
}
else{
$regPwd = $login_admin['reg_pwd'];
if($regPwd!==''){
redirect('/home/index/edit_password.html')->send();
exit;
}
if (!$this->checkAuth()) {
if (request()->isAjax()) {
return to_assign(405, ',');
} else {
redirect('/home/index/role')->send();
exit;
}
}
}
}
}
}
/**
*
* @DateTime 2020-12-21
* @param string $controller
* @param string $action
* @return [type]
*/
protected function checkAuth()
{
//Cache::delete('RulesSrc' . $uid);
$uid = $this->uid;
$GOUGU = new Systematic();
$GOUGU->auth($uid);
$auth_list_all = Cache::get('RulesSrc0');
$auth_list = Cache::get('RulesSrc' . $uid);
$pathUrl = $this->module . '/' . $this->controller . '/' . $this->action;
if (!in_array($pathUrl, $auth_list)) {
return false;
} else {
return true;
}
}
}
Function Calls
| None |
Stats
| MD5 | 2b0b365e9610c1febab83401e583c740 |
| Eval Count | 0 |
| Decode Time | 62 ms |