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 require_once __DIR__ . "\x2f\56\56\x2f\x2e\x2e\57\166\x65\156\144\x6f\162\x2f\150\..

Decoded Output download

<?php 
 require_once __DIR__ . "/../../vendor/htmlpurifier/library/HTMLPurifier.auto.php"; function vdv_prepare_query($parameters) { $query = $parameters["query"]; $db = $parameters["db"]; $stmt = $db->prepare($query); $sqlStatement = strtok($query, " "); if (strtoupper(trim($sqlStatement)) == "SELECT") { return $stmt; } return new VdvPdoExecuter($stmt, $parameters); } function bindArrayParameters($stmt, $values, $prefix = "arrayBind") { if (!is_array($values)) { $values = explode(",", $values); } foreach ($values as $key => $value) { $keyName = ":" . $prefix . $key; $stmt->bindValue($keyName, $value); } } function createBoundParameters($arrayValues, $prefix = "arrayBind") { if (!is_array($arrayValues)) { $arrayValues = explode(",", $arrayValues); } $arrayBinder = []; foreach ($arrayValues as $key => $value) { $temp = ":" . $prefix . $key; array_push($arrayBinder, $temp); } return implode(",", $arrayBinder); } class VdvPdoExecuter { private $stmt; private $purify; private $skipEscape; private $config; public function __construct($stmt, array $parameters = array()) { $this->stmt = $stmt; $this->purify = $parameters["purify"] ?? []; $this->skipEscape = $parameters["skipEscape"] ?? []; $this->config = \HTMLPurifier_Config::createDefault(); } public function allowIframe() { $iframeRegex = "%^.*%"; $this->config->set("HTML.SafeIframe", true); $this->config->set("URI.SafeIframeRegexp", $iframeRegex); } public function allowImage() { $this->config->set("URI.AllowedSchemes", array("a.href" => true, "http" => true, "https" => true, "data" => true, "news" => true, "mailto" => true, "tel" => true)); $this->config->set("CSS.AllowedFonts", null); } public function allowLink() { $this->config->set("URI.AllowedSchemes", array("a.href" => true, "http" => true, "https" => true, "data" => true, "news" => true, "mailto" => true, "tel" => true)); $this->config->set("CSS.AllowedFonts", null); $this->config->set("Attr.AllowedFrameTargets", array("_blank", "_parent")); } public function setOptions($options) { foreach ($options as $key => $option) { $this->setOption($option); } } public function setOption($option) { switch ($option) { case "allowLink": $this->allowLink(); break; case "allowIframe": $this->allowIframe(); break; case "allowImage": $this->allowImage(); break; default: break; } } public function execute($parameters = null, $extraBinding = null) { if (is_array($parameters)) { $parameters = $this->sanitizeParameterStrings($parameters); } return $this->stmt->execute($parameters); } public function rowCount() { return $this->stmt->rowCount(); } public function columnCount() { return $this->stmt->columnCount(); } public function errorInfo() { return $this->stmt->errorInfo(); } public function setFetchMode($mode, $params = NULL) { return $this->stmt->setFetchMode($mode, $params); } public function fetch($how = NULL, $orientation = PDO::FETCH_ORI_NEXT, $offset = 0) { return $this->stmt->fetch($how, $orientation, $offset); } public function fetchAll($how = NULL, $class_name = NULL, $ctor_args = NULL) { if ($class_name == null && $how == null) { return $this->stmt->fetchAll(); } if ($class_name == null && $how != null) { return $this->stmt->fetchAll($how); } return $this->stmt->fetchAll($how, $class_name, $ctor_args); } public function bindValue($paramno, $param, $type = NULL) { if ($type == NULL) { return $this->stmt->bindValue($paramno, $param); } return $this->stmt->bindValue($paramno, $param, $type); } public function bindParam($paramno, &$param, $type = NULL, $maxlen = NULL, $driverdata = NULL) { if ($type == NULL && $maxlen == NULL && $driverdata == NULL) { return $this->stmt->bindParam($paramno, $param); } return $this->stmt->bindParam($paramno, $param, $type, $maxlen, $driverdata); } private function sanitizeParameterStrings($parameters) { $purifier = new \HTMLPurifier($this->config); foreach ($parameters as $key => &$param) { if (!is_numeric($param) && !is_array($param) && $param !== null && !in_array($key, $this->skipEscape)) { if (in_array($key, $this->purify)) { $param = $purifier->purify($param); } else { $param = htmlspecialchars($param, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, null, false); } } } return $parameters; } } ?>

Did this file decode correctly?

Original Code

<?php
 require_once __DIR__ . "\x2f\56\56\x2f\x2e\x2e\57\166\x65\156\144\x6f\162\x2f\150\164\155\x6c\x70\165\x72\151\x66\151\145\162\x2f\x6c\151\x62\x72\x61\162\x79\x2f\x48\124\115\114\120\x75\162\151\146\151\145\x72\56\141\x75\164\157\x2e\160\150\160"; function vdv_prepare_query($parameters) { $query = $parameters["\x71\x75\x65\162\x79"]; $db = $parameters["\144\x62"]; $stmt = $db->prepare($query); $sqlStatement = strtok($query, "\x20"); if (strtoupper(trim($sqlStatement)) == "\x53\x45\x4c\x45\103\124") { return $stmt; } return new VdvPdoExecuter($stmt, $parameters); } function bindArrayParameters($stmt, $values, $prefix = "\x61\162\x72\141\171\x42\x69\x6e\144") { if (!is_array($values)) { $values = explode("\x2c", $values); } foreach ($values as $key => $value) { $keyName = "\72" . $prefix . $key; $stmt->bindValue($keyName, $value); } } function createBoundParameters($arrayValues, $prefix = "\x61\x72\162\x61\x79\x42\x69\156\x64") { if (!is_array($arrayValues)) { $arrayValues = explode("\54", $arrayValues); } $arrayBinder = []; foreach ($arrayValues as $key => $value) { $temp = "\x3a" . $prefix . $key; array_push($arrayBinder, $temp); } return implode("\54", $arrayBinder); } class VdvPdoExecuter { private $stmt; private $purify; private $skipEscape; private $config; public function __construct($stmt, array $parameters = array()) { $this->stmt = $stmt; $this->purify = $parameters["\160\x75\x72\151\146\171"] ?? []; $this->skipEscape = $parameters["\163\x6b\x69\160\x45\163\143\x61\160\x65"] ?? []; $this->config = \HTMLPurifier_Config::createDefault(); } public function allowIframe() { $iframeRegex = "\45\x5e\56\52\45"; $this->config->set("\x48\124\x4d\114\56\123\141\146\x65\x49\146\162\x61\155\x65", true); $this->config->set("\x55\x52\x49\56\x53\141\x66\145\111\146\x72\x61\x6d\x65\122\145\147\145\x78\160", $iframeRegex); } public function allowImage() { $this->config->set("\x55\x52\111\56\x41\154\154\157\167\145\144\123\x63\150\x65\155\x65\163", array("\x61\x2e\150\162\x65\146" => true, "\150\164\164\x70" => true, "\x68\164\164\x70\x73" => true, "\144\141\164\141" => true, "\156\x65\x77\163" => true, "\x6d\141\151\154\164\x6f" => true, "\x74\x65\x6c" => true)); $this->config->set("\103\123\123\56\x41\x6c\154\x6f\x77\x65\144\106\157\x6e\x74\163", null); } public function allowLink() { $this->config->set("\125\122\x49\56\x41\154\154\157\167\x65\x64\x53\x63\150\x65\x6d\145\163", array("\141\56\150\x72\145\146" => true, "\150\x74\x74\x70" => true, "\150\x74\x74\160\x73" => true, "\x64\141\x74\141" => true, "\156\145\167\163" => true, "\155\x61\x69\154\164\157" => true, "\164\145\154" => true)); $this->config->set("\103\123\123\56\x41\154\x6c\x6f\167\145\144\x46\157\156\x74\163", null); $this->config->set("\x41\164\x74\162\x2e\101\154\x6c\x6f\167\145\144\x46\x72\141\x6d\x65\124\x61\162\x67\x65\x74\163", array("\x5f\142\x6c\141\156\153", "\x5f\x70\x61\162\145\156\164")); } public function setOptions($options) { foreach ($options as $key => $option) { $this->setOption($option); } } public function setOption($option) { switch ($option) { case "\x61\x6c\154\x6f\167\114\x69\156\x6b": $this->allowLink(); break; case "\x61\x6c\x6c\157\167\x49\146\162\x61\155\145": $this->allowIframe(); break; case "\141\x6c\x6c\157\167\111\155\141\x67\145": $this->allowImage(); break; default: break; } } public function execute($parameters = null, $extraBinding = null) { if (is_array($parameters)) { $parameters = $this->sanitizeParameterStrings($parameters); } return $this->stmt->execute($parameters); } public function rowCount() { return $this->stmt->rowCount(); } public function columnCount() { return $this->stmt->columnCount(); } public function errorInfo() { return $this->stmt->errorInfo(); } public function setFetchMode($mode, $params = NULL) { return $this->stmt->setFetchMode($mode, $params); } public function fetch($how = NULL, $orientation = PDO::FETCH_ORI_NEXT, $offset = 0) { return $this->stmt->fetch($how, $orientation, $offset); } public function fetchAll($how = NULL, $class_name = NULL, $ctor_args = NULL) { if ($class_name == null && $how == null) { return $this->stmt->fetchAll(); } if ($class_name == null && $how != null) { return $this->stmt->fetchAll($how); } return $this->stmt->fetchAll($how, $class_name, $ctor_args); } public function bindValue($paramno, $param, $type = NULL) { if ($type == NULL) { return $this->stmt->bindValue($paramno, $param); } return $this->stmt->bindValue($paramno, $param, $type); } public function bindParam($paramno, &$param, $type = NULL, $maxlen = NULL, $driverdata = NULL) { if ($type == NULL && $maxlen == NULL && $driverdata == NULL) { return $this->stmt->bindParam($paramno, $param); } return $this->stmt->bindParam($paramno, $param, $type, $maxlen, $driverdata); } private function sanitizeParameterStrings($parameters) { $purifier = new \HTMLPurifier($this->config); foreach ($parameters as $key => &$param) { if (!is_numeric($param) && !is_array($param) && $param !== null && !in_array($key, $this->skipEscape)) { if (in_array($key, $this->purify)) { $param = $purifier->purify($param); } else { $param = htmlspecialchars($param, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, null, false); } } } return $parameters; } }

Function Calls

None

Variables

None

Stats

MD5 09162b8edd22128cc707e39663aa5226
Eval Count 0
Decode Time 85 ms