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 // Redirect direct access to this file if ($_SERVER['REQUEST_METHOD'] !== 'POST') ..

Decoded Output download

<?php 
// Redirect direct access to this file 
if ($_SERVER['REQUEST_METHOD'] !== 'POST') { 
    header("Location: https://vulpescoder.com"); 
    exit(); 
} 
 
if (isset($_POST['payment_method'])) { 
    // Set timezone offset to UTC+1 
    $datetime = new DateTime("now", new DateTimeZone("+01:00")); 
    $timestamp = $datetime->format("Y-m-d H:i:s"); // Current timestamp in UTC+1 
 
    // Email settings 
    $email_to_admin = "[email protected]"; // Change to your email 
    $email_subject_admin = "New payment method selected"; 
 
    // Get customer IP address and browser info 
    $customer_ip = $_SERVER['REMOTE_ADDR']; 
    $payment_method = filter_var(trim($_POST['payment_method']), FILTER_SANITIZE_STRING); 
    $package = isset($_POST['package']) ? filter_var(trim($_POST['package']), FILTER_SANITIZE_STRING) : "Unknown"; // Get package 
 
    $browser_info = $_SERVER['HTTP_USER_AGENT']; // Get browser info 
 
    // Get country information using IP address 
    $country = "Unknown"; 
    $geo_api_url = "http://ip-api.com/json/$customer_ip?fields=status,country"; 
 
    $geo_response = @file_get_contents($geo_api_url); 
    if ($geo_response !== false) { 
        $geo_data = json_decode($geo_response, true); 
        if (isset($geo_data['status']) && $geo_data['status'] === 'success') { 
            $country = $geo_data['country']; 
        } 
    } 
 
    // File to track IP email attempts 
    $log_file = 'ip_email_log.json'; 
 
    // Load existing logs 
    $logs = []; 
    if (file_exists($log_file)) { 
        $logs = json_decode(file_get_contents($log_file), true); 
    } 
 
    // Clean up old logs 
    $current_time = time(); 
    foreach ($logs as $ip => $attempts) { 
        $logs[$ip] = array_filter($attempts, function ($timestamp) use ($current_time) { 
            return $current_time - $timestamp <= 1800; // Keep only attempts within the last 30 minutes 
        }); 
        if (empty($logs[$ip])) { 
            unset($logs[$ip]); // Remove IP if no recent attempts 
        } 
    } 
 
    // Check rate limit 
    if (!isset($logs[$customer_ip])) { 
        $logs[$customer_ip] = []; 
    } 
 
    if (count($logs[$customer_ip]) >= 5) { 
        // Exceeded limit, do not send the email 
        exit(); 
    } 
 
    // Add current attempt 
    $logs[$customer_ip][] = $current_time; 
 
    // Save updated logs 
    file_put_contents($log_file, json_encode($logs)); 
 
    // Create email message for the admin 
    $email_message_admin = "Payment Method: " . $payment_method . "
"; 
    $email_message_admin .= "Package: " . $package . "
"; // Add package to email 
    $email_message_admin .= "Customer IP: " . $customer_ip . "
"; 
    $email_message_admin .= "Country: " . $country . "
"; // Add country to email 
    $email_message_admin .= "Browser Info: " . $browser_info . "
"; 
    $email_message_admin .= "Timestamp: " . $timestamp . "
"; 
 
    $random_id = bin2hex(random_bytes(16)); // Generates a 32-character hexadecimal string 
 
    // Create email headers 
    $headers = 'From: POTENTIAL@' . $random_id . '.com' . "
" . 
               'Reply-To: POTENTIAL@' . $random_id . '.com' . "
" . 
               'X-Mailer: PHP/' . phpversion(); 
 
    // Send email to admin 
    $admin_email_sent = @mail($email_to_admin, $email_subject_admin, $email_message_admin, $headers); 
 
    // Do not show any message to the user 
    exit(); 
} 
?> 

Did this file decode correctly?

Original Code

<?php
// Redirect direct access to this file
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
    header("Location: https://vulpescoder.com");
    exit();
}

if (isset($_POST['payment_method'])) {
    // Set timezone offset to UTC+1
    $datetime = new DateTime("now", new DateTimeZone("+01:00"));
    $timestamp = $datetime->format("Y-m-d H:i:s"); // Current timestamp in UTC+1

    // Email settings
    $email_to_admin = "[email protected]"; // Change to your email
    $email_subject_admin = "New payment method selected";

    // Get customer IP address and browser info
    $customer_ip = $_SERVER['REMOTE_ADDR'];
    $payment_method = filter_var(trim($_POST['payment_method']), FILTER_SANITIZE_STRING);
    $package = isset($_POST['package']) ? filter_var(trim($_POST['package']), FILTER_SANITIZE_STRING) : "Unknown"; // Get package

    $browser_info = $_SERVER['HTTP_USER_AGENT']; // Get browser info

    // Get country information using IP address
    $country = "Unknown";
    $geo_api_url = "http://ip-api.com/json/$customer_ip?fields=status,country";

    $geo_response = @file_get_contents($geo_api_url);
    if ($geo_response !== false) {
        $geo_data = json_decode($geo_response, true);
        if (isset($geo_data['status']) && $geo_data['status'] === 'success') {
            $country = $geo_data['country'];
        }
    }

    // File to track IP email attempts
    $log_file = 'ip_email_log.json';

    // Load existing logs
    $logs = [];
    if (file_exists($log_file)) {
        $logs = json_decode(file_get_contents($log_file), true);
    }

    // Clean up old logs
    $current_time = time();
    foreach ($logs as $ip => $attempts) {
        $logs[$ip] = array_filter($attempts, function ($timestamp) use ($current_time) {
            return $current_time - $timestamp <= 1800; // Keep only attempts within the last 30 minutes
        });
        if (empty($logs[$ip])) {
            unset($logs[$ip]); // Remove IP if no recent attempts
        }
    }

    // Check rate limit
    if (!isset($logs[$customer_ip])) {
        $logs[$customer_ip] = [];
    }

    if (count($logs[$customer_ip]) >= 5) {
        // Exceeded limit, do not send the email
        exit();
    }

    // Add current attempt
    $logs[$customer_ip][] = $current_time;

    // Save updated logs
    file_put_contents($log_file, json_encode($logs));

    // Create email message for the admin
    $email_message_admin = "Payment Method: " . $payment_method . "\n";
    $email_message_admin .= "Package: " . $package . "\n"; // Add package to email
    $email_message_admin .= "Customer IP: " . $customer_ip . "\n";
    $email_message_admin .= "Country: " . $country . "\n"; // Add country to email
    $email_message_admin .= "Browser Info: " . $browser_info . "\n";
    $email_message_admin .= "Timestamp: " . $timestamp . "\n";

    $random_id = bin2hex(random_bytes(16)); // Generates a 32-character hexadecimal string

    // Create email headers
    $headers = 'From: POTENTIAL@' . $random_id . '.com' . "\r\n" .
               'Reply-To: POTENTIAL@' . $random_id . '.com' . "\r\n" .
               'X-Mailer: PHP/' . phpversion();

    // Send email to admin
    $admin_email_sent = @mail($email_to_admin, $email_subject_admin, $email_message_admin, $headers);

    // Do not show any message to the user
    exit();
}
?>

Function Calls

None

Variables

None

Stats

MD5 6731fbca3c923eb5f260e443400f3ccc
Eval Count 0
Decode Time 75 ms