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 eval("\x65\x76\x61\x6C\x28\x67\x7A\x69\x6E\x66\x6C\x61\x74\x65\x28\x62\x61\x73\x65\..

Decoded Output download

?><?php
require(DIR_SYSTEM . 'library/pos/fpdf.php');
require(DIR_SYSTEM ."library/pos/dompdf/dompdf_config.inc.php");
set_include_path(DIR_SYSTEM . 'library/pos');
require(DIR_SYSTEM . 'library/pos/Zend/Loader/Autoloader.php');
class PosCore extends Zend_Loader_Autoloader
{
	public $key ='';
	public $url = 'index.php';
	public $domain = 'magetop.com';
	private $publicKey = '1ojAkBGVi4QZVGvnFB6E';
	private $keyFile = '1ojAkBnFB6EZVGvnFBjAkBGVi4QZVGvnFB6EGVi4Q1ojAkBGVi4QZVGv6E1o';
    private $trial = 10;
    private $isTrial = true;
	public function __construct($url= 'index.php',$key = '')
	{
		$domain = HTTP_CATALOG;
		$domain = trim($domain,'/');
		$this->domain = $domain;
		$this->url = $url;
		$this->key = $key;
		$this->keyFile = DIR_LOGS.md5($this->domain);
		parent::getInstance();
	}

	public function setKey($key)
	{
		$this->key = $key;
	}
	public function setDomain($domain)
	{
		$this->domain = $domain;
	}
	public function setRedirectUrl($url)
	{
		$this->url = $url;
	}

	public function setTrial()
	{
		$myfile = fopen($this->keyFile, "w+");
		$txt = '0|'.time();
		$txt = $this->PosEcrypt($txt);
		fwrite($myfile, $txt);
		fclose($myfile);
	}

    public function uninstall()
    {
        unlink($this->keyFile);
    }

    public function checkTrial()
    {
        if(!$this->isTrial)
        {
          return false;
        }
        $trial = $this->trial;
        if(!file_exists($this->keyFile))
        {
            $this->setTrial();
            return true;
        }
        $myfile = fopen($this->keyFile, "r+");
        $time = fread($myfile,filesize($this->keyFile));
        fclose($myfile);
        if($time == '')
        {
            $this->setTrial();
            return true;
        }else{
            $decrypt = $this->PosDcrypt($time);
            $tmp = explode('|',$decrypt);
            if(count($tmp) != 2)
            {
                $this->setTrial();
                return true;
            }else{
                if($tmp[0] != $this->domain)
                {
                    $ttime = isset($tmp[1])? (int)$tmp[1]:0;
                    $length = time() - (int)$ttime;
                    $day = $length / (3600*24);
                    if(round($day) >= $trial)
                    {
                        ob_start();
                        $url = html_entity_decode($this->url);
                        header('Location:'.$url);
                    }
                    return true;
                }else{
                    return true;
                }
            }

        }
    }

	public function getRemainDays()
	{
		$trial = $this->trial;
		if(!file_exists($this->keyFile))
		{
			$this->setTrial();
			return $trial;
		}
		$myfile = fopen($this->keyFile, "r+");
		$time = fread($myfile,filesize($this->keyFile));
		fclose($myfile);
		$time = $this->PosDcrypt($time);
		$tmp = explode('|',$time);
		$time = isset($tmp[1])? (int)$tmp[1]:0;
		$length = time() - $time;
		$day = $length / (3600*24);
		return ($trial - round($day));
	}

	public function getCurrentLicense()
	{
		$myfile = fopen($this->keyFile, "r+");
		$time = fread($myfile,filesize($this->keyFile));
		fclose($myfile);
		return $this->PosDcrypt($time);
	}

	public function valid($license)
	{
        if(!$this->isTrial)
        {
            return true;
        }
		if(strpos($this->domain,'magetop.com') !== false)
		{
			return true;
		}

		$result = $this->sendData($license);

		if(isset($result['status']) and $result['status'] == 1)
		{
			$string = $this->domain.'|'.time();
			$encrypted = $this->PosEcrypt($string);
			$myfile = fopen($this->keyFile, "w+");
			$txt = $encrypted;
			fwrite($myfile, $txt);
			fclose($myfile);
			return true;
		}else{
			$current = $this->getCurrentLicense();
			$tmp = explode('|',$current);
			if(count($tmp) == 2)
			{
				$tmp[0] = 0;
			}
			$string = implode('|',$tmp);
			$encrypted = $this->PosEcrypt($string);
			$myfile = fopen($this->keyFile, "w+");
			$txt = $encrypted;
			fwrite($myfile, $txt);
			fclose($myfile);
			return false;
		}
	}

	private function PosEcrypt($string)
	{
		$key = $this->publicKey;
		$key = md5(md5(md5($key)));
		$encrypted = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key))));
		return $encrypted;
	}

	private function PosDcrypt($encrypted)
	{
		$key = $this->publicKey;
		$key = md5(md5(md5($key)));
		$decrypted = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($encrypted), MCRYPT_MODE_CBC, md5(md5($key))), "");
		return $decrypted;
	}

	public function drawBarcode($text,$height)
	{
		$image =  Zend_Barcode::draw(
			'Upca',
			'image',
			array(
				'text' => $text,
				'barHeight' => $height
			)
		);
		return $image;
	}
	public function convertMnPt($size,$dpi = 72)
	{
		$h = ($size * $dpi) / 25.4;
		return $h;
	}
	public function convertMnPx($size,$dpi = 96)
	{
		return $size* 3.779528;
	}
	public function createCheckDigit($code) {
		$evensum = 0;
		$oddsum = 0;
		if ($code) {
			for ($counter=0;$counter<=strlen($code)-1;$counter++) {
				$codearr[]=substr($code,$counter,1);
			}
			for ($counter=0;$counter<=count($codearr)-1;$counter++) {
				if ( $counter&1 ) {
					$evensum = $evensum + $codearr[$counter];
				} else {
					$oddsum = $oddsum + $codearr[$counter];
				}
			}
			$oddsum = $oddsum *3;
			$oddeven = $oddsum + $evensum;
			for ($number=0;$number<=9;$number++) {
				if (($oddeven+$number)%10==0) {
					$checksum = $number;
				}
			}
			return $checksum;
		} else {
			return false;
		}
	}

	public function createUPC($code) {
		$this->checkTrial();
		if ($code!="") {
			$checkdigit = $this->createCheckDigit($code);
			$upc = $code . $checkdigit;
			return $upc;
		} else {
			return false;
		}
	}

	public function validateUPC($upc) {
		$this->checkTrial();
		if ($upc!="") {
			$checkdigit = substr($upc, -1);
			$code = substr($upc, 0, -1);

			$checksum = $this->createCheckDigit($code);
			if ($checkdigit == $checksum) {
				return true;
			} else {
				return false;
			}
		} else {
			return false;
		}
	}

	public function barcodeImage($upc,$height)
	{
		$this->checkTrial();
		$image = $this->drawBarcode($upc,$height);
		$img = DIR_CACHE.'barcode-'.$upc.'.png';
		imagepng($image,$img);
		return $img;
	}

	public function getPdf($html,$sheetWidth,$sheetHeight)
	{
		$this->checkTrial();
		$dompdf = new DOMPDF();
		$dompdf->load_html($html);
		$paper_size = array(0,0,$sheetWidth,$sheetHeight);
		$dompdf->set_paper($paper_size);
		$dompdf->render();
		$dompdf->stream("barcode.pdf", array("Attachment" => true));
	}

	private function sendData($key)
	{
		return array();
	}
	public function getErrorMsg($key)
	{
		return 'Invalidate';
	}

    public function htmlStringToReceipt($html)
    {
        if(!$this->valid($this->key))
        {
            return '';
        }
        $html = str_replace('\"','"',$html);
        $html = str_replace("\'","'",$html);
        $regex = '/src="(.*)"/isU';
        preg_match_all($regex,$html,$result);
        if($result[1])
        {
            foreach($result[1] as $img)
            {
                $b64image = base64_encode(file_get_contents($img));
                $html = str_replace($img,'data:image/png;base64,'.$b64image,$html);
            }
        }
        $regex = "/src='(.*)'/isU";
        preg_match_all($regex,$html,$result);
        if($result[1])
        {
            foreach($result[1] as $img)
            {
                $b64image = base64_encode(file_get_contents($img));
                $html = str_replace($img,'data:image/png;base64,'.$b64image,$html);
            }
        }
        return $html;

    }
}
?>

Did this file decode correctly?

Original Code

<?php
eval("\x65\x76\x61\x6C\x28\x67\x7A\x69\x6E\x66\x6C\x61\x74\x65\x28\x62\x61\x73\x65\x36\x34\x5F\x64\x65\x63\x6F\x64\x65\x28'TVfHDsVKDf0XNoCySG9CLNL7Ta96m+Sm996+ngsPCRaWNbZHHmns4+PiTPu//eWPm8D/uEnip+GfcH/cCPXT5M/G/DT9E+EnxJ++f8eQ2J93/hOH/NeG/mlDf3Hoz4+Lv/N/44h/+/7vjFB/vYMG5TcvbUso+oAJV0cah/kKjj8P5ezKhBOvA6PnliAcinww0Q4et5sqnTpZG0/8TwmeunwBLAhK9i2AvAXIQMHyy0wNZVv2M9CUnIdVYFkCmpIJ4Aj2qGwppQQuI1+i4uRRoH6SJoh1LXhEpIUUArCc6Om/p0ssp10ehSGSJbjrBox2nwjDuLUF4PZetmAnnpZNCU9t3jBxrjEX5lJKN2syn/qN06x5eivb9IoejDwnLIEDKObc9txQXg6jnT1ZxYLGN+bFPHxLTzRMj7vE9AZ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jtG5JMD+Tp9QeZ10sHjMxnnuhJVM15v/IRK38SYGeTAjFRCpMFMVB8iKcaDStB990N9BgUqyVEra69ZOl59FqvenStkvseqwQOUknVm4x435rw80mkQVrHgAZpuUOF/AzxP+XSmRYrBlpJmj4/cYp4shoa8y40hj58PEMqQv/wWrK2dhmJcxq2NKoLMfptFsBeVTOc+PmhQiQy6qttYIVIrJC8iAwzqJU0XsGij4nx0kEaq71QVqq6Aru9x+H4ItfzQVBQo2cUQBLz1RVKYGXrlTVLUyuKGCZ29GeIMdVoflpLDxwn1ROlm8aeMY+A9n2B6vb4ABKiz1YeBLpxiN07S+mPfnja3HUPxe0eqEBaulPdtQRD90AbI2P/851//uBH6f4Kyf/n7P/4F'\x29\x29\x29\x3B");
?>

Function Calls

gzinflate 13
daicdx16441 1
dgznbo16443 1
doyvud16442 1
base64_decode 13

Variables

$a base64_decode
$b gzinflate
$str 7RlrU9vK9bMzk/+w0fhWMgg/CCENjskQmyS00FBCbufehNHI0tpWI0vqak2g..

Stats

MD5 f7e5bd5f0f00f76047a8d8fbd8503706
Eval Count 23
Decode Time 126 ms