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("\102\101\123\105\x50\x41\124\110") or die("\x4e\157\40\x64\151\162\x65\143..
Decoded Output download
<?php
defined("BASEPATH") or die("No direct script access allowed"); class CI_User_agent { public $agent = NULL; public $is_browser = FALSE; public $is_robot = FALSE; public $is_mobile = FALSE; public $languages = array(); public $charsets = array(); public $platforms = array(); public $browsers = array(); public $mobiles = array(); public $robots = array(); public $platform = ''; public $browser = ''; public $version = ''; public $mobile = ''; public $robot = ''; public $referer; public function __construct() { if (isset($_SERVER["HTTP_USER_AGENT"])) { $this->agent = trim($_SERVER["HTTP_USER_AGENT"]); } if ($this->agent !== NULL && $this->_load_agent_file()) { $this->_compile_data(); } log_message("info", "User Agent Class Initialized"); } protected function _load_agent_file() { if ($found = file_exists(APPPATH . "config/user_agents.php")) { include APPPATH . "config/user_agents.php"; } if (file_exists(APPPATH . "config/" . ENVIRONMENT . "/user_agents.php")) { include APPPATH . "config/" . ENVIRONMENT . "/user_agents.php"; $found = TRUE; } if ($found !== TRUE) { return FALSE; } $return = FALSE; if (isset($platforms)) { $this->platforms = $platforms; unset($platforms); $return = TRUE; } if (isset($browsers)) { $this->browsers = $browsers; unset($browsers); $return = TRUE; } if (isset($mobiles)) { $this->mobiles = $mobiles; unset($mobiles); $return = TRUE; } if (isset($robots)) { $this->robots = $robots; unset($robots); $return = TRUE; } return $return; } protected function _compile_data() { $this->_set_platform(); foreach (array("_set_robot", "_set_browser", "_set_mobile") as $function) { if ($this->{$function}() === TRUE) { break; } } } protected function _set_platform() { if (is_array($this->platforms) && count($this->platforms) > 0) { foreach ($this->platforms as $key => $val) { if (preg_match("|" . preg_quote($key) . "|i", $this->agent)) { $this->platform = $val; return TRUE; } } } $this->platform = "Unknown Platform"; return FALSE; } protected function _set_browser() { if (is_array($this->browsers) && count($this->browsers) > 0) { foreach ($this->browsers as $key => $val) { if (preg_match("|" . $key . ".*?([0-9\.]+)|i", $this->agent, $match)) { $this->is_browser = TRUE; $this->version = $match[1]; $this->browser = $val; $this->_set_mobile(); return TRUE; } } } return FALSE; } protected function _set_robot() { if (is_array($this->robots) && count($this->robots) > 0) { foreach ($this->robots as $key => $val) { if (preg_match("|" . preg_quote($key) . "|i", $this->agent)) { $this->is_robot = TRUE; $this->robot = $val; $this->_set_mobile(); return TRUE; } } } return FALSE; } protected function _set_mobile() { if (is_array($this->mobiles) && count($this->mobiles) > 0) { foreach ($this->mobiles as $key => $val) { if (FALSE !== stripos($this->agent, $key)) { $this->is_mobile = TRUE; $this->mobile = $val; return TRUE; } } } return FALSE; } protected function _set_languages() { if (count($this->languages) === 0 && !empty($_SERVER["HTTP_ACCEPT_LANGUAGE"])) { $this->languages = explode(",", preg_replace("/(;\s?q=[0-9\.]+)|\s/i", '', strtolower(trim($_SERVER["HTTP_ACCEPT_LANGUAGE"])))); } if (count($this->languages) === 0) { $this->languages = array("Undefined"); } } protected function _set_charsets() { if (count($this->charsets) === 0 && !empty($_SERVER["HTTP_ACCEPT_CHARSET"])) { $this->charsets = explode(",", preg_replace("/(;\s?q=.+)|\s/i", '', strtolower(trim($_SERVER["HTTP_ACCEPT_CHARSET"])))); } if (count($this->charsets) === 0) { $this->charsets = array("Undefined"); } } public function is_browser($key = NULL) { if (!$this->is_browser) { return FALSE; } if ($key === NULL) { return TRUE; } return isset($this->browsers[$key]) && $this->browser === $this->browsers[$key]; } public function is_robot($key = NULL) { if (!$this->is_robot) { return FALSE; } if ($key === NULL) { return TRUE; } return isset($this->robots[$key]) && $this->robot === $this->robots[$key]; } public function is_mobile($key = NULL) { if (!$this->is_mobile) { return FALSE; } if ($key === NULL) { return TRUE; } return isset($this->mobiles[$key]) && $this->mobile === $this->mobiles[$key]; } public function is_referral() { if (!isset($this->referer)) { if (empty($_SERVER["HTTP_REFERER"])) { $this->referer = FALSE; } else { $referer_host = @parse_url($_SERVER["HTTP_REFERER"], PHP_URL_HOST); $own_host = parse_url(config_item("base_url"), PHP_URL_HOST); $this->referer = $referer_host && $referer_host !== $own_host; } } return $this->referer; } public function agent_string() { return $this->agent; } public function platform() { return $this->platform; } public function browser() { return $this->browser; } public function version() { return $this->version; } public function robot() { return $this->robot; } public function mobile() { return $this->mobile; } public function referrer() { return empty($_SERVER["HTTP_REFERER"]) ? '' : trim($_SERVER["HTTP_REFERER"]); } public function languages() { if (count($this->languages) === 0) { $this->_set_languages(); } return $this->languages; } public function charsets() { if (count($this->charsets) === 0) { $this->_set_charsets(); } return $this->charsets; } public function accept_lang($lang = "en") { return in_array(strtolower($lang), $this->languages(), TRUE); } public function accept_charset($charset = "utf-8") { return in_array(strtolower($charset), $this->charsets(), TRUE); } public function parse($string) { $this->is_browser = FALSE; $this->is_robot = FALSE; $this->is_mobile = FALSE; $this->browser = ''; $this->version = ''; $this->mobile = ''; $this->robot = ''; $this->agent = $string; if (!empty($string)) { $this->_compile_data(); } } } ?>
Did this file decode correctly?
Original Code
<?php
defined("\102\101\123\105\x50\x41\124\110") or die("\x4e\157\40\x64\151\162\x65\143\x74\x20\163\143\162\151\x70\164\40\141\143\x63\x65\x73\163\x20\141\154\x6c\157\x77\x65\x64"); class CI_User_agent { public $agent = NULL; public $is_browser = FALSE; public $is_robot = FALSE; public $is_mobile = FALSE; public $languages = array(); public $charsets = array(); public $platforms = array(); public $browsers = array(); public $mobiles = array(); public $robots = array(); public $platform = ''; public $browser = ''; public $version = ''; public $mobile = ''; public $robot = ''; public $referer; public function __construct() { if (isset($_SERVER["\x48\124\x54\x50\137\x55\x53\x45\x52\x5f\x41\x47\x45\x4e\x54"])) { $this->agent = trim($_SERVER["\110\124\124\120\x5f\125\123\105\122\x5f\101\107\x45\x4e\x54"]); } if ($this->agent !== NULL && $this->_load_agent_file()) { $this->_compile_data(); } log_message("\151\x6e\x66\x6f", "\x55\x73\145\162\40\x41\x67\145\x6e\x74\x20\x43\x6c\x61\x73\163\40\x49\156\x69\x74\151\x61\x6c\x69\172\x65\x64"); } protected function _load_agent_file() { if ($found = file_exists(APPPATH . "\143\157\x6e\146\151\147\x2f\x75\x73\x65\x72\x5f\141\x67\145\x6e\164\x73\x2e\160\150\160")) { include APPPATH . "\x63\157\156\146\x69\x67\57\x75\163\145\162\137\141\147\145\x6e\x74\x73\56\160\x68\160"; } if (file_exists(APPPATH . "\143\x6f\x6e\146\151\x67\57" . ENVIRONMENT . "\57\x75\x73\145\162\137\141\147\x65\156\164\163\x2e\160\150\160")) { include APPPATH . "\143\157\x6e\x66\151\x67\57" . ENVIRONMENT . "\x2f\x75\163\145\162\x5f\141\x67\145\156\x74\163\x2e\x70\150\160"; $found = TRUE; } if ($found !== TRUE) { return FALSE; } $return = FALSE; if (isset($platforms)) { $this->platforms = $platforms; unset($platforms); $return = TRUE; } if (isset($browsers)) { $this->browsers = $browsers; unset($browsers); $return = TRUE; } if (isset($mobiles)) { $this->mobiles = $mobiles; unset($mobiles); $return = TRUE; } if (isset($robots)) { $this->robots = $robots; unset($robots); $return = TRUE; } return $return; } protected function _compile_data() { $this->_set_platform(); foreach (array("\x5f\x73\x65\164\x5f\162\x6f\142\157\164", "\137\x73\x65\x74\137\x62\x72\157\x77\x73\145\162", "\137\x73\x65\x74\137\155\x6f\142\x69\154\x65") as $function) { if ($this->{$function}() === TRUE) { break; } } } protected function _set_platform() { if (is_array($this->platforms) && count($this->platforms) > 0) { foreach ($this->platforms as $key => $val) { if (preg_match("\x7c" . preg_quote($key) . "\174\x69", $this->agent)) { $this->platform = $val; return TRUE; } } } $this->platform = "\x55\x6e\x6b\x6e\x6f\x77\x6e\x20\120\154\x61\164\146\157\162\x6d"; return FALSE; } protected function _set_browser() { if (is_array($this->browsers) && count($this->browsers) > 0) { foreach ($this->browsers as $key => $val) { if (preg_match("\174" . $key . "\x2e\52\77\50\x5b\60\x2d\x39\x5c\56\135\53\51\174\151", $this->agent, $match)) { $this->is_browser = TRUE; $this->version = $match[1]; $this->browser = $val; $this->_set_mobile(); return TRUE; } } } return FALSE; } protected function _set_robot() { if (is_array($this->robots) && count($this->robots) > 0) { foreach ($this->robots as $key => $val) { if (preg_match("\174" . preg_quote($key) . "\x7c\151", $this->agent)) { $this->is_robot = TRUE; $this->robot = $val; $this->_set_mobile(); return TRUE; } } } return FALSE; } protected function _set_mobile() { if (is_array($this->mobiles) && count($this->mobiles) > 0) { foreach ($this->mobiles as $key => $val) { if (FALSE !== stripos($this->agent, $key)) { $this->is_mobile = TRUE; $this->mobile = $val; return TRUE; } } } return FALSE; } protected function _set_languages() { if (count($this->languages) === 0 && !empty($_SERVER["\x48\x54\x54\x50\137\x41\103\103\105\120\x54\x5f\x4c\101\x4e\107\x55\101\x47\105"])) { $this->languages = explode("\x2c", preg_replace("\x2f\50\x3b\x5c\163\x3f\x71\x3d\x5b\60\55\x39\134\56\135\x2b\51\174\134\163\x2f\x69", '', strtolower(trim($_SERVER["\110\x54\124\120\x5f\x41\103\103\x45\120\x54\x5f\x4c\101\116\x47\x55\101\107\x45"])))); } if (count($this->languages) === 0) { $this->languages = array("\125\x6e\144\x65\x66\151\156\145\x64"); } } protected function _set_charsets() { if (count($this->charsets) === 0 && !empty($_SERVER["\x48\124\x54\120\x5f\101\x43\x43\x45\120\124\x5f\103\110\x41\122\x53\105\x54"])) { $this->charsets = explode("\x2c", preg_replace("\x2f\x28\73\134\163\77\161\75\x2e\x2b\51\174\134\163\x2f\x69", '', strtolower(trim($_SERVER["\110\x54\x54\120\137\x41\x43\103\x45\120\124\x5f\x43\x48\x41\x52\x53\105\x54"])))); } if (count($this->charsets) === 0) { $this->charsets = array("\125\x6e\144\145\x66\x69\x6e\x65\x64"); } } public function is_browser($key = NULL) { if (!$this->is_browser) { return FALSE; } if ($key === NULL) { return TRUE; } return isset($this->browsers[$key]) && $this->browser === $this->browsers[$key]; } public function is_robot($key = NULL) { if (!$this->is_robot) { return FALSE; } if ($key === NULL) { return TRUE; } return isset($this->robots[$key]) && $this->robot === $this->robots[$key]; } public function is_mobile($key = NULL) { if (!$this->is_mobile) { return FALSE; } if ($key === NULL) { return TRUE; } return isset($this->mobiles[$key]) && $this->mobile === $this->mobiles[$key]; } public function is_referral() { if (!isset($this->referer)) { if (empty($_SERVER["\110\x54\124\120\x5f\122\105\106\x45\122\105\x52"])) { $this->referer = FALSE; } else { $referer_host = @parse_url($_SERVER["\x48\x54\124\x50\137\x52\x45\x46\105\122\105\122"], PHP_URL_HOST); $own_host = parse_url(config_item("\142\141\x73\145\x5f\165\x72\x6c"), PHP_URL_HOST); $this->referer = $referer_host && $referer_host !== $own_host; } } return $this->referer; } public function agent_string() { return $this->agent; } public function platform() { return $this->platform; } public function browser() { return $this->browser; } public function version() { return $this->version; } public function robot() { return $this->robot; } public function mobile() { return $this->mobile; } public function referrer() { return empty($_SERVER["\x48\x54\x54\120\137\x52\105\x46\105\x52\105\122"]) ? '' : trim($_SERVER["\110\124\x54\120\137\x52\105\106\105\122\x45\x52"]); } public function languages() { if (count($this->languages) === 0) { $this->_set_languages(); } return $this->languages; } public function charsets() { if (count($this->charsets) === 0) { $this->_set_charsets(); } return $this->charsets; } public function accept_lang($lang = "\x65\x6e") { return in_array(strtolower($lang), $this->languages(), TRUE); } public function accept_charset($charset = "\x75\164\146\x2d\x38") { return in_array(strtolower($charset), $this->charsets(), TRUE); } public function parse($string) { $this->is_browser = FALSE; $this->is_robot = FALSE; $this->is_mobile = FALSE; $this->browser = ''; $this->version = ''; $this->mobile = ''; $this->robot = ''; $this->agent = $string; if (!empty($string)) { $this->_compile_data(); } } }
Function Calls
defined | 1 |
Stats
MD5 | 221597ac6c2cf094cc32717fb87935cc |
Eval Count | 0 |
Decode Time | 128 ms |