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 defined("\x42\101\x53\105\120\101\124\x48") or die("\116\x6f\40\x64\x69\x72\x65\14..

Decoded Output download

<?php 
 defined("BASEPATH") or die("No direct script access allowed"); class Shopee extends CI_Controller { var $id_ecom; var $partnerId; var $partnerKey; var $host; public function __construct() { parent::__construct(); $this->id_ecom = 1; $this->partnerId = 1055141; $this->partnerKey = "74566674526a754a446b7674584e755970774b6456676e54414c454e7162724c"; $this->host = "https://partner.test-stable.shopeemobile.com"; } public function authorization() { $path = "/api/v2/shop/auth_partner"; $redirectUrl = site_url("api/shopee/authentication"); $timest = time(); $baseString = sprintf("%s%s%s", $this->partnerId, $path, $timest); $sign = hash_hmac("sha256", $baseString, $this->partnerKey); $url = sprintf("%s%s?partner_id=%s&timestamp=%s&sign=%s&redirect=%s", $this->host, $path, $this->partnerId, $timest, $sign, $redirectUrl); echo "<a href="" . $url . "">cekcek</a>"; } public function authentication() { $code = $this->input->get("code"); $shopId = $this->input->get("shop_id"); $path = "/api/v2/auth/token/get"; $timest = time(); $body = array("code" => $code, "shop_id" => (int) $shopId, "partner_id" => (int) $this->partnerId); $baseString = sprintf("%s%s%s", $this->partnerId, $path, $timest); $sign = hash_hmac("sha256", $baseString, $this->partnerKey); $url = sprintf("%s%s?partner_id=%s&timestamp=%s&sign=%s", $this->host, $path, $this->partnerId, $timest, $sign); $c = curl_init($url); curl_setopt($c, CURLOPT_POST, 1); curl_setopt($c, CURLOPT_POSTFIELDS, json_encode($body)); curl_setopt($c, CURLOPT_HTTPHEADER, array("Content-Type: application/json")); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); $resp = curl_exec($c); $arrResponse = !empty($resp) ? json_decode($resp, TRUE) : array(); if (count($arrResponse) > 0) { $is_error = $arrResponse["error"] ?? "x"; if (empty($is_error)) { $access_token = $arrResponse["access_token"] ?? ''; $refresh_token = $arrResponse["refresh_token"] ?? ''; $expire_in = $arrResponse["expire_in"] ?? ''; $request_id = $arrResponse["request_id"] ?? ''; if (!empty($access_token) && !empty($refresh_token) && !empty($expire_in)) { $expire = $expire_in - 1800; $date_exp = date("Y-m-d H:i:s", strtotime("+" . $expire . " seconds")); $date_input = date("Y-m-d H:i:s"); $user_id = $this->session->userdata("user_id"); $arrToken = array("user_request" => $user_id, "access_token" => $access_token, "refresh_token" => $refresh_token, "request_id" => $request_id); $jsonToken = json_encode($arrToken); $arraySave = array("id_ecom" => $this->id_ecom, "date_input" => $date_input, "date_exp" => $date_exp, "detail_data" => $detail_data); $act = $this->general_model->save("ecommerce_token", $arraySave, "de"); if ($act) { } else { } } else { echo "Some data is empty, raw : " . json_encode($arrResponse); } } else { echo "Error, raw : " . json_encode($arrResponse); } } else { echo "Error authentication"; } } } ?>

Did this file decode correctly?

Original Code

<?php
 defined("\x42\101\x53\105\120\101\124\x48") or die("\116\x6f\40\x64\x69\x72\x65\143\164\40\x73\143\162\x69\160\164\x20\141\x63\x63\145\163\x73\x20\141\154\x6c\157\x77\145\144"); class Shopee extends CI_Controller { var $id_ecom; var $partnerId; var $partnerKey; var $host; public function __construct() { parent::__construct(); $this->id_ecom = 1; $this->partnerId = 1055141; $this->partnerKey = "\x37\64\65\66\66\66\67\64\65\62\66\141\67\65\64\x61\x34\x34\x36\x62\x37\x36\x37\x34\65\70\64\x65\67\65\x35\71\x37\60\67\x37\x34\142\66\64\65\66\x36\x37\x36\x65\65\x34\x34\x31\64\143\x34\x35\x34\x65\67\x31\66\62\x37\x32\64\143"; $this->host = "\x68\164\164\160\163\x3a\x2f\x2f\160\x61\162\x74\156\145\x72\56\x74\145\x73\x74\55\163\x74\141\142\154\145\56\163\x68\157\160\x65\145\x6d\157\142\x69\154\145\56\x63\x6f\x6d"; } public function authorization() { $path = "\x2f\x61\x70\x69\57\166\x32\x2f\163\x68\x6f\x70\57\141\165\x74\150\137\160\141\x72\x74\x6e\x65\162"; $redirectUrl = site_url("\141\x70\151\x2f\x73\150\x6f\160\145\x65\x2f\x61\165\164\x68\x65\156\164\151\143\x61\x74\151\x6f\x6e"); $timest = time(); $baseString = sprintf("\x25\163\45\163\45\x73", $this->partnerId, $path, $timest); $sign = hash_hmac("\163\150\x61\x32\x35\66", $baseString, $this->partnerKey); $url = sprintf("\45\163\45\163\x3f\160\x61\x72\164\156\x65\162\137\x69\x64\75\45\x73\46\164\x69\x6d\145\x73\x74\x61\x6d\x70\75\45\163\x26\x73\x69\x67\x6e\x3d\x25\163\x26\162\x65\x64\151\x72\145\x63\x74\75\x25\163", $this->host, $path, $this->partnerId, $timest, $sign, $redirectUrl); echo "\74\x61\x20\x68\162\145\146\x3d\42" . $url . "\x22\76\x63\x65\x6b\143\145\153\x3c\x2f\141\76"; } public function authentication() { $code = $this->input->get("\x63\x6f\144\x65"); $shopId = $this->input->get("\x73\150\157\x70\x5f\151\144"); $path = "\57\141\x70\x69\x2f\x76\62\x2f\x61\x75\x74\150\x2f\164\157\x6b\145\x6e\57\x67\145\164"; $timest = time(); $body = array("\x63\x6f\144\145" => $code, "\x73\150\x6f\x70\x5f\151\144" => (int) $shopId, "\160\x61\x72\x74\x6e\x65\162\x5f\x69\144" => (int) $this->partnerId); $baseString = sprintf("\x25\163\45\x73\45\163", $this->partnerId, $path, $timest); $sign = hash_hmac("\163\150\141\62\65\x36", $baseString, $this->partnerKey); $url = sprintf("\x25\163\x25\x73\x3f\160\x61\x72\x74\x6e\x65\x72\x5f\151\144\x3d\x25\x73\46\x74\x69\155\145\163\x74\141\155\160\x3d\45\163\x26\x73\151\147\x6e\x3d\45\163", $this->host, $path, $this->partnerId, $timest, $sign); $c = curl_init($url); curl_setopt($c, CURLOPT_POST, 1); curl_setopt($c, CURLOPT_POSTFIELDS, json_encode($body)); curl_setopt($c, CURLOPT_HTTPHEADER, array("\x43\157\156\164\145\x6e\x74\x2d\x54\171\x70\x65\72\40\141\160\x70\154\x69\143\x61\x74\151\157\156\57\x6a\x73\x6f\x6e")); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); $resp = curl_exec($c); $arrResponse = !empty($resp) ? json_decode($resp, TRUE) : array(); if (count($arrResponse) > 0) { $is_error = $arrResponse["\x65\162\x72\157\x72"] ?? "\170"; if (empty($is_error)) { $access_token = $arrResponse["\x61\x63\143\x65\x73\x73\x5f\x74\x6f\x6b\145\156"] ?? ''; $refresh_token = $arrResponse["\x72\x65\x66\x72\x65\163\150\x5f\164\x6f\x6b\x65\x6e"] ?? ''; $expire_in = $arrResponse["\145\170\x70\151\162\145\x5f\x69\x6e"] ?? ''; $request_id = $arrResponse["\162\x65\x71\165\145\x73\164\137\151\144"] ?? ''; if (!empty($access_token) && !empty($refresh_token) && !empty($expire_in)) { $expire = $expire_in - 1800; $date_exp = date("\131\x2d\155\x2d\144\40\x48\72\x69\x3a\x73", strtotime("\x2b" . $expire . "\40\x73\145\143\x6f\156\x64\x73")); $date_input = date("\x59\55\155\x2d\x64\x20\110\72\x69\x3a\163"); $user_id = $this->session->userdata("\165\x73\x65\x72\137\x69\144"); $arrToken = array("\x75\x73\x65\x72\x5f\162\145\x71\165\145\x73\x74" => $user_id, "\141\143\143\145\x73\163\137\164\x6f\x6b\x65\x6e" => $access_token, "\x72\145\x66\162\x65\x73\x68\x5f\164\157\153\145\x6e" => $refresh_token, "\x72\x65\x71\x75\145\x73\164\137\x69\x64" => $request_id); $jsonToken = json_encode($arrToken); $arraySave = array("\x69\x64\x5f\145\143\x6f\x6d" => $this->id_ecom, "\x64\141\164\x65\137\x69\156\160\x75\x74" => $date_input, "\x64\x61\x74\x65\x5f\145\x78\160" => $date_exp, "\144\x65\164\141\x69\x6c\137\144\141\164\x61" => $detail_data); $act = $this->general_model->save("\x65\143\157\x6d\155\x65\x72\143\145\137\164\157\153\145\156", $arraySave, "\144\x65"); if ($act) { } else { } } else { echo "\x53\157\155\145\x20\x64\x61\x74\141\40\x69\163\40\x65\155\160\x74\x79\x2c\40\x72\x61\x77\x20\x3a\x20" . json_encode($arrResponse); } } else { echo "\x45\x72\162\x6f\162\x2c\40\x72\x61\167\x20\72\x20" . json_encode($arrResponse); } } else { echo "\x45\x72\162\x6f\162\40\x61\165\164\150\145\x6e\x74\x69\143\141\164\151\157\156"; } } }

Function Calls

None

Variables

None

Stats

MD5 39865c91757db17aa221f08a7db99ea0
Eval Count 0
Decode Time 71 ms