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 goto ybIKZ; ybIKZ: ini_set("\144\x69\x73\x70\x6c\x61\x79\x5f\x65\x72\x72\x6f\162\1..

Decoded Output download

<?php 
 goto ybIKZ; ybIKZ: ini_set("display_errors", 1); goto dOnbU; yIRNv: $external_db_name = "u963328086_comprador"; goto pRySO; zHY4O: if ($conn_external->connect_error) { die("External connection failed: " . $conn_external->connect_error); } goto nGB0d; KuJrL: error_reporting(E_ALL); goto ez5V8; EhwlN: $external_db_user = "u963328086_compradoruser"; goto r6MIW; eqTvU: if ($conn_local->connect_error) { die("Connection failed: " . $conn_local->connect_error); } goto VIgo4; N2RTg: $result = $conn_local->query("SHOW COLUMNS FROM short_links LIKE 'url_base'"); goto PgruT; GU0QW: if ($conn_local->query($sql) === FALSE) { die("Error creating table: " . $conn_local->error); } goto GWZw2; pRySO: $conn_external = new mysqli($external_db_host, $external_db_user, $external_db_password, $external_db_name); goto zHY4O; TwqEv: require_once $_SERVER["DOCUMENT_ROOT"] . "/wp-config.php"; goto hrfJP; ez5V8: header("Access-Control-Allow-Origin: *"); goto NlHYH; XTaeA: header("Access-Control-Allow-Headers: Content-Type"); goto TwqEv; ScsFt: if ($_SERVER["REQUEST_METHOD"] == "POST") { if (isset($_POST["long_url"]) && isset($_POST["client_name"]) && isset($_POST["email"])) { $long_url = $_POST["long_url"]; $client_name = $_POST["client_name"]; $email = $_POST["email"]; if (!preg_match("/^http(s)?:\/\//", $long_url)) { $long_url = "http://" . $long_url; } $stmt = $conn_external->prepare("SELECT user_email FROM wp_users WHERE user_email = ?"); $stmt->bind_param("s", $email); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows == 0) { echo json_encode(array("error" => "Erro email n\xc3\243o encontrado.")); $stmt->close(); $conn_external->close(); $conn_local->close(); die; } $stmt->close(); $short_code = generateShortCode(); $stmt = $conn_local->prepare("SELECT * FROM short_links WHERE short_code = ?"); $stmt->bind_param("s", $short_code); $stmt->execute(); $result = $stmt->get_result(); while ($result->num_rows > 0) { $short_code = generateShortCode(); $stmt->execute(); $result = $stmt->get_result(); } $url_base = "https://" . $_SERVER["HTTP_HOST"]; $stmt = $conn_local->prepare("INSERT INTO short_links (long_url, short_code, client_name, url_base) VALUES (?, ?, ?, ?)"); $stmt->bind_param("ssss", $long_url, $short_code, $client_name, $url_base); if ($stmt->execute()) { echo json_encode(array("short_url" => $short_code)); } else { echo json_encode(array("error" => "Erro ao salvar o link: " . $stmt->error)); } $stmt->close(); } else { echo json_encode(array("error" => "URL longa, nome do cliente ou email n\303\243o fornecidos.")); } } goto ZCkm8; ZCkm8: if ($_SERVER["REQUEST_METHOD"] == "GET" && isset($_GET["code"])) { $short_code = $_GET["code"]; $stmt = $conn_local->prepare("SELECT long_url, clicks, client_name FROM short_links WHERE short_code = ?"); $stmt->bind_param("s", $short_code); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows > 0) { $row = $result->fetch_assoc(); $new_clicks = $row["clicks"] + 1; $update_stmt = $conn_local->prepare("UPDATE short_links SET clicks = ? WHERE short_code = ?"); $update_stmt->bind_param("is", $new_clicks, $short_code); $update_stmt->execute(); $update_stmt->close(); include "notificacao-email.php"; $client_name = $row["client_name"]; $long_url = $row["long_url"]; if (enviarEmailNotificacao($client_name, $short_code, $long_url)) { header("Location: " . $long_url); die; } else { echo "Erro ao enviar e-mail."; } } else { http_response_code(404); echo "Link n\xc3\243o encontrado."; } $stmt->close(); } goto SJN93; GWZw2: $result = $conn_local->query("SHOW COLUMNS FROM short_links LIKE 'clicks'"); goto gf3Mk; gf3Mk: if ($result->num_rows == 0) { $conn_local->query("ALTER TABLE short_links ADD COLUMN clicks INT DEFAULT 0"); } goto N2RTg; nGB0d: $sql = "CREATE TABLE IF NOT EXISTS short_links (
    id INT AUTO_INCREMENT PRIMARY KEY,
    long_url TEXT NOT NULL,
    short_code VARCHAR(10) NOT NULL UNIQUE,
    clicks INT DEFAULT 0,
    client_name VARCHAR(255) NOT NULL,
    url_base TEXT,\xa    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP\xa)"; goto GU0QW; MFnS3: $conn_external->close(); goto yt12k; NlHYH: header("Access-Control-Allow-Methods: POST, GET, OPTIONS"); goto XTaeA; VIgo4: $external_db_host = "srv816.hstgr.io"; goto EhwlN; PgruT: if ($result->num_rows == 0) { $conn_local->query("ALTER TABLE short_links ADD COLUMN url_base TEXT"); } goto C60gR; hrfJP: $conn_local = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); goto eqTvU; SJN93: $conn_local->close(); goto MFnS3; r6MIW: $external_db_password = "J5n*iICXHJ6"; goto yIRNv; C60gR: function generateShortCode($length = 6) { return substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length); } goto ScsFt; dOnbU: ini_set("display_startup_errors", 1); goto KuJrL; yt12k: ?>

Did this file decode correctly?

Original Code

<?php
 goto ybIKZ; ybIKZ: ini_set("\144\x69\x73\x70\x6c\x61\x79\x5f\x65\x72\x72\x6f\162\163", 1); goto dOnbU; yIRNv: $external_db_name = "\x75\71\66\63\63\x32\70\60\70\66\x5f\x63\157\x6d\160\162\141\144\157\x72"; goto pRySO; zHY4O: if ($conn_external->connect_error) { die("\x45\170\164\x65\162\156\141\x6c\x20\143\157\x6e\x6e\145\143\x74\x69\157\156\40\x66\x61\151\154\145\x64\72\40" . $conn_external->connect_error); } goto nGB0d; KuJrL: error_reporting(E_ALL); goto ez5V8; EhwlN: $external_db_user = "\165\x39\66\x33\x33\x32\x38\60\x38\66\x5f\143\x6f\x6d\x70\x72\x61\144\x6f\x72\x75\x73\x65\x72"; goto r6MIW; eqTvU: if ($conn_local->connect_error) { die("\103\157\x6e\x6e\145\143\164\x69\x6f\x6e\x20\x66\141\151\x6c\x65\144\x3a\x20" . $conn_local->connect_error); } goto VIgo4; N2RTg: $result = $conn_local->query("\x53\x48\x4f\x57\40\103\117\x4c\125\x4d\x4e\123\x20\x46\x52\x4f\x4d\x20\163\150\x6f\162\164\x5f\x6c\x69\x6e\153\163\40\x4c\111\113\x45\x20\x27\x75\162\154\137\x62\x61\x73\x65\x27"); goto PgruT; GU0QW: if ($conn_local->query($sql) === FALSE) { die("\x45\x72\162\x6f\x72\x20\143\162\145\141\164\151\156\x67\40\x74\141\142\x6c\x65\72\x20" . $conn_local->error); } goto GWZw2; pRySO: $conn_external = new mysqli($external_db_host, $external_db_user, $external_db_password, $external_db_name); goto zHY4O; TwqEv: require_once $_SERVER["\x44\117\x43\125\115\x45\x4e\x54\x5f\x52\117\117\124"] . "\57\167\160\55\x63\x6f\156\x66\x69\147\x2e\x70\150\160"; goto hrfJP; ez5V8: header("\101\x63\x63\x65\x73\x73\55\103\157\156\x74\x72\157\x6c\x2d\x41\154\154\157\167\55\117\162\151\x67\151\156\72\40\52"); goto NlHYH; XTaeA: header("\x41\143\143\145\x73\x73\x2d\103\x6f\x6e\x74\x72\157\x6c\55\101\154\x6c\157\167\55\110\x65\x61\x64\145\x72\x73\72\40\103\x6f\x6e\x74\145\156\x74\55\124\171\x70\x65"); goto TwqEv; ScsFt: if ($_SERVER["\x52\105\121\125\105\x53\x54\137\x4d\105\124\x48\117\x44"] == "\120\x4f\x53\124") { if (isset($_POST["\x6c\157\156\147\x5f\165\162\x6c"]) && isset($_POST["\x63\154\x69\145\156\164\x5f\x6e\x61\x6d\145"]) && isset($_POST["\x65\x6d\x61\x69\154"])) { $long_url = $_POST["\154\x6f\156\147\137\165\162\154"]; $client_name = $_POST["\143\154\x69\145\x6e\x74\x5f\156\x61\155\x65"]; $email = $_POST["\x65\x6d\141\x69\x6c"]; if (!preg_match("\57\x5e\150\164\164\160\50\163\51\77\72\134\x2f\134\57\x2f", $long_url)) { $long_url = "\150\x74\x74\160\x3a\57\x2f" . $long_url; } $stmt = $conn_external->prepare("\123\105\x4c\105\x43\124\x20\165\163\145\x72\x5f\x65\155\x61\x69\154\40\x46\x52\x4f\115\x20\x77\x70\137\x75\x73\x65\x72\x73\40\127\x48\x45\122\x45\40\165\x73\145\x72\137\x65\155\141\151\154\x20\75\40\77"); $stmt->bind_param("\x73", $email); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows == 0) { echo json_encode(array("\145\x72\162\x6f\162" => "\105\x72\162\x6f\x20\x65\155\141\151\154\x20\x6e\xc3\243\x6f\x20\145\156\143\x6f\x6e\164\162\141\x64\157\56")); $stmt->close(); $conn_external->close(); $conn_local->close(); die; } $stmt->close(); $short_code = generateShortCode(); $stmt = $conn_local->prepare("\123\105\x4c\x45\x43\124\x20\52\x20\x46\x52\117\x4d\40\x73\x68\x6f\x72\x74\137\154\x69\x6e\x6b\x73\40\x57\x48\x45\122\x45\40\163\150\x6f\x72\x74\x5f\143\157\x64\x65\x20\75\40\77"); $stmt->bind_param("\x73", $short_code); $stmt->execute(); $result = $stmt->get_result(); while ($result->num_rows > 0) { $short_code = generateShortCode(); $stmt->execute(); $result = $stmt->get_result(); } $url_base = "\x68\164\x74\x70\x73\x3a\x2f\57" . $_SERVER["\110\124\x54\x50\x5f\x48\x4f\x53\124"]; $stmt = $conn_local->prepare("\x49\116\123\105\x52\124\40\x49\116\x54\117\x20\163\150\157\x72\x74\137\x6c\x69\156\153\x73\x20\50\x6c\x6f\156\147\x5f\165\x72\154\54\40\x73\150\x6f\x72\x74\x5f\x63\157\144\145\x2c\40\143\154\151\x65\x6e\x74\x5f\x6e\x61\x6d\145\x2c\x20\165\162\x6c\137\x62\x61\x73\145\x29\x20\126\x41\114\125\105\123\40\50\x3f\54\40\x3f\x2c\x20\77\x2c\40\77\x29"); $stmt->bind_param("\163\163\x73\x73", $long_url, $short_code, $client_name, $url_base); if ($stmt->execute()) { echo json_encode(array("\x73\150\x6f\x72\x74\137\165\162\154" => $short_code)); } else { echo json_encode(array("\x65\x72\162\x6f\x72" => "\x45\x72\x72\x6f\40\x61\157\40\163\x61\x6c\166\x61\162\x20\x6f\x20\154\151\x6e\153\72\40" . $stmt->error)); } $stmt->close(); } else { echo json_encode(array("\x65\162\162\157\x72" => "\x55\122\x4c\40\x6c\x6f\x6e\x67\141\54\x20\156\x6f\155\x65\x20\x64\x6f\40\x63\154\151\x65\x6e\164\145\40\x6f\x75\40\x65\x6d\141\151\154\40\x6e\303\243\157\40\146\157\162\156\x65\x63\x69\144\157\x73\56")); } } goto ZCkm8; ZCkm8: if ($_SERVER["\122\105\x51\x55\105\x53\x54\x5f\x4d\105\x54\x48\x4f\104"] == "\x47\x45\124" && isset($_GET["\x63\157\144\x65"])) { $short_code = $_GET["\143\157\x64\x65"]; $stmt = $conn_local->prepare("\x53\x45\114\105\103\124\x20\x6c\x6f\x6e\x67\x5f\165\162\x6c\x2c\x20\x63\154\151\143\x6b\163\54\40\x63\x6c\151\145\156\164\137\156\141\x6d\x65\40\x46\x52\x4f\115\40\163\150\x6f\162\164\x5f\154\151\156\153\x73\40\x57\x48\105\122\x45\x20\163\150\157\x72\164\137\143\157\x64\145\x20\75\40\x3f"); $stmt->bind_param("\163", $short_code); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows > 0) { $row = $result->fetch_assoc(); $new_clicks = $row["\x63\x6c\151\x63\x6b\163"] + 1; $update_stmt = $conn_local->prepare("\125\120\x44\101\124\105\40\x73\x68\x6f\x72\164\137\154\x69\156\x6b\163\x20\x53\105\x54\40\143\154\x69\x63\153\x73\40\75\40\77\40\x57\110\x45\x52\x45\40\163\150\157\162\164\x5f\143\157\144\x65\40\75\x20\77"); $update_stmt->bind_param("\x69\163", $new_clicks, $short_code); $update_stmt->execute(); $update_stmt->close(); include "\x6e\x6f\x74\x69\x66\151\x63\x61\143\141\x6f\x2d\x65\x6d\141\x69\154\x2e\x70\150\160"; $client_name = $row["\143\154\151\x65\156\164\137\156\x61\155\145"]; $long_url = $row["\154\157\x6e\x67\137\165\162\154"]; if (enviarEmailNotificacao($client_name, $short_code, $long_url)) { header("\x4c\x6f\143\x61\164\151\157\x6e\x3a\40" . $long_url); die; } else { echo "\x45\x72\162\157\x20\x61\x6f\x20\145\156\166\x69\x61\162\x20\x65\55\x6d\141\151\x6c\x2e"; } } else { http_response_code(404); echo "\x4c\x69\x6e\x6b\x20\156\xc3\243\157\40\x65\x6e\x63\157\156\164\x72\141\x64\x6f\56"; } $stmt->close(); } goto SJN93; GWZw2: $result = $conn_local->query("\x53\110\x4f\127\x20\103\117\114\125\115\x4e\x53\x20\x46\122\117\115\x20\x73\x68\157\x72\164\x5f\x6c\151\156\153\163\x20\x4c\111\x4b\x45\x20\x27\x63\x6c\151\x63\153\x73\47"); goto gf3Mk; gf3Mk: if ($result->num_rows == 0) { $conn_local->query("\101\x4c\124\x45\122\40\x54\101\102\x4c\x45\40\x73\150\x6f\162\164\137\x6c\151\156\153\x73\x20\101\x44\104\40\x43\117\x4c\125\115\x4e\x20\143\x6c\151\x63\153\x73\40\x49\x4e\x54\x20\104\x45\106\101\125\114\124\40\x30"); } goto N2RTg; nGB0d: $sql = "\x43\x52\x45\101\124\105\40\124\x41\102\x4c\x45\40\111\106\40\116\117\x54\40\105\x58\x49\x53\x54\123\x20\x73\150\x6f\162\164\137\154\151\156\x6b\x73\40\x28\12\40\40\40\40\x69\144\40\x49\116\x54\40\x41\125\x54\117\x5f\111\116\103\x52\x45\115\105\x4e\124\x20\120\122\111\115\101\122\131\40\x4b\x45\x59\54\12\x20\40\40\x20\x6c\157\156\x67\137\165\162\x6c\40\x54\x45\130\124\40\116\x4f\124\x20\116\x55\x4c\114\x2c\12\40\40\40\40\x73\x68\157\x72\x74\137\x63\x6f\144\145\40\x56\x41\x52\x43\x48\101\x52\50\x31\x30\51\40\116\x4f\124\40\x4e\125\x4c\114\40\x55\x4e\111\121\125\x45\54\12\40\x20\x20\x20\x63\x6c\x69\x63\153\x73\40\111\116\124\x20\104\x45\x46\101\x55\114\x54\40\x30\54\12\40\40\x20\x20\x63\154\151\x65\x6e\x74\x5f\156\x61\x6d\x65\40\x56\x41\x52\103\x48\x41\x52\x28\x32\x35\x35\x29\x20\116\117\x54\40\x4e\x55\x4c\x4c\x2c\12\40\40\x20\x20\165\162\x6c\x5f\x62\x61\x73\145\40\x54\105\130\124\54\xa\x20\x20\x20\40\x63\x72\145\x61\x74\x65\144\137\x61\x74\40\x54\111\115\x45\123\x54\101\115\120\x20\104\x45\106\101\x55\114\124\x20\103\x55\122\x52\105\x4e\x54\137\x54\x49\115\105\123\x54\101\x4d\120\xa\x29"; goto GU0QW; MFnS3: $conn_external->close(); goto yt12k; NlHYH: header("\101\x63\x63\x65\163\163\x2d\x43\157\156\x74\x72\157\154\x2d\x41\154\x6c\157\167\x2d\x4d\x65\164\150\x6f\x64\x73\x3a\40\120\117\x53\124\54\40\x47\x45\x54\54\40\117\x50\124\111\117\x4e\123"); goto XTaeA; VIgo4: $external_db_host = "\x73\x72\166\x38\61\66\x2e\x68\163\x74\x67\x72\56\x69\157"; goto EhwlN; PgruT: if ($result->num_rows == 0) { $conn_local->query("\x41\x4c\x54\x45\122\40\x54\101\x42\x4c\105\40\163\x68\x6f\x72\164\137\154\x69\x6e\x6b\x73\x20\101\104\104\x20\x43\x4f\114\125\x4d\x4e\x20\165\x72\154\x5f\142\x61\x73\x65\x20\124\105\130\x54"); } goto C60gR; hrfJP: $conn_local = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); goto eqTvU; SJN93: $conn_local->close(); goto MFnS3; r6MIW: $external_db_password = "\112\65\x6e\x2a\151\x49\x43\130\x48\112\x36"; goto yIRNv; C60gR: function generateShortCode($length = 6) { return substr(str_shuffle("\x30\61\62\63\x34\65\66\x37\x38\71\x61\x62\x63\x64\145\146\147\150\x69\152\x6b\154\x6d\156\x6f\160\161\162\163\164\165\166\x77\170\x79\172\101\x42\x43\104\105\106\x47\x48\x49\112\113\114\x4d\x4e\x4f\120\x51\122\123\x54\x55\x56\x57\130\x59\132"), 0, $length); } goto ScsFt; dOnbU: ini_set("\144\x69\163\x70\x6c\x61\x79\x5f\x73\x74\x61\x72\164\x75\x70\x5f\x65\x72\x72\x6f\162\x73", 1); goto KuJrL; yt12k: ?>

Function Calls

None

Variables

None

Stats

MD5 9b39a7cf7a542631e10aedcb4603b704
Eval Count 0
Decode Time 39 ms