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 "support/loginSession/session.php"; require "../config/dbConfig.php"; req..

Decoded Output download

<?php 
require "support/loginSession/session.php"; 
require "../config/dbConfig.php"; 
require "controller/controllerPage.php"; 
 
// URL to fetch the plan data 
$url = "https://cms.epaperscript.com/lab/api/plans.php"; 
// Fetch JSON data from the URL 
$jsonData = file_get_contents($url); 
// Check if data fetching was successful 
if ($jsonData === false) { 
    die("Error occurred while fetching data."); 
} 
// Decode JSON data into a PHP array 
$plans = json_decode($jsonData, true); 
// Initialize the planNameMapping array 
$planNameMapping = []; 
// Create a mapping of plan IDs to plan names for easy lookup, and to store storage and page_views 
$storageMapping = []; 
$pageViewsMapping = []; 
if (!empty($plans)) { 
    foreach ($plans as $plan) { 
        $planNameMapping[$plan["id"]] = $plan["name"]; 
        $storageMapping[$plan["id"]] = $plan["storage"]; 
        $pageViewsMapping[$plan["id"]] = $plan["page_views"]; 
    } 
} 
 
$authToken = $client_id; // Replace $client_id with your actual authToken 
$url = "https://cms.epaperscript.com/lab/api/api.php"; // The API URL 
 
// Initialize a cURL session 
$ch = curl_init($url); 
 
// Set cURL options 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return the response as a string 
curl_setopt($ch, CURLOPT_POST, true); // Set the request method to POST 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Disable SSL verification (optional, use with caution in production) 
 
// Set the POST fields (data to send) 
$data = [ 
    "authToken" => $authToken, 
]; 
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); 
 
// Execute the cURL request 
$response = curl_exec($ch); 
 
// Check for cURL errors 
if (curl_errno($ch)) { 
    echo "cURL Error: " . curl_error($ch); 
} else { 
    // Decode the JSON response and store it in a variable 
    $json_response = json_decode($response, true); 
 
    // Store each response field in separate variables 
    if (isset($json_response[0])) { 
        $status = $json_response[0]["status"]; 
        $expireDateTimestamp = $json_response[0]["expireDate"]; 
        $expireDate = date("Y-m-d H:i:s", $expireDateTimestamp); // Convert timestamp to readable format 
        $authTokenResponse = $json_response[0]["authToken"]; 
        $planId = $json_response[0]["activePlan"]; 
        $licensetype = $json_response[0]["licensetype"]; 
 
        $expireDateShow = date("d/m/Y", $expireDateTimestamp); 
 
        // Check expiration status 
        $currentDate = time(); // Current timestamp 
        $expireDateInSeconds = $expireDateTimestamp; // Expiry timestamp 
 
        if ($expireDateInSeconds < $currentDate) { 
            // License expired 
            $licenseCk = '<div class="col-lg-12 col-md-12 col-12"> 
    <div class="alert alert-info align-items-center mb-10 animated-border" role="alert"  
         style="border-radius: 3px; 
    background: #ffd1e0 !important; 
    color: #b4013e;border: 1px solid"> 
        <div class="w-100"> 
            <h6><i class="fa-solid fa-triangle-exclamation me-2"></i> License Expired</h6> 
        </div> 
        <div class="w-100 align-items-center"> 
             
            <span>Your plan has expired. You <b>can\'t upload</b> any new edition.</span> 
        </div> 
    </div> 
</div>'; 
        } elseif ($expireDateInSeconds - $currentDate <= 7 * 24 * 60 * 60) { 
            // License will expire within 7 days 
            $licenseCk = 
                '<div class="col-lg-12 col-md-12 col-12"> 
    <div class="alert alert-info align-items-center mb-10 animated-border" role="alert"  
         style=" 
border-radius: 3px; 
    background: #ffeee0; 
    color: #87430b; border: 1px solid"> 
        <div class="w-100"> 
            <h6><i class="fa-solid fa-triangle-exclamation me-2"></i> License Expiry Alert</h6> 
        </div> 
        <div class="w-100 align-items-center"> 
             
            <span>Your license will expire on <b><u>'. $expireDateShow .'</u></b>. Renew now!</span> 
        </div> 
    </div> 
</div> 
'; 
        } else { 
            // License is valid 
            $licenseCk = ""; 
        } 
 
        // Initialize variables for storage and page_views for the matched plan 
        $matchedStorage = null; 
        $matchedPageViews = null; 
 
        if (isset($planNameMapping[$planId])) { 
            // If the plan ID exists in the mapping, store its values 
            $matchedPlanName    = $planNameMapping[$planId]; 
            $matchedStorage     = $storageMapping[$planId]; 
            $matchedPageViews   = $pageViewsMapping[$planId]; 
        } else { 
            //echo "No matching plan found for Plan ID: " . $planId . "
"; 
        } 
    } else { 
        echo "No data found in the response."; 
    } 
} 
// Close the cURL session 
curl_close($ch); 
?>

Did this file decode correctly?

Original Code

<?php
require "support/loginSession/session.php";
require "../config/dbConfig.php";
require "controller/controllerPage.php";

// URL to fetch the plan data
$url = "https://cms.epaperscript.com/lab/api/plans.php";
// Fetch JSON data from the URL
$jsonData = file_get_contents($url);
// Check if data fetching was successful
if ($jsonData === false) {
    die("Error occurred while fetching data.");
}
// Decode JSON data into a PHP array
$plans = json_decode($jsonData, true);
// Initialize the planNameMapping array
$planNameMapping = [];
// Create a mapping of plan IDs to plan names for easy lookup, and to store storage and page_views
$storageMapping = [];
$pageViewsMapping = [];
if (!empty($plans)) {
    foreach ($plans as $plan) {
        $planNameMapping[$plan["id"]] = $plan["name"];
        $storageMapping[$plan["id"]] = $plan["storage"];
        $pageViewsMapping[$plan["id"]] = $plan["page_views"];
    }
}

$authToken = $client_id; // Replace $client_id with your actual authToken
$url = "https://cms.epaperscript.com/lab/api/api.php"; // The API URL

// Initialize a cURL session
$ch = curl_init($url);

// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return the response as a string
curl_setopt($ch, CURLOPT_POST, true); // Set the request method to POST
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Disable SSL verification (optional, use with caution in production)

// Set the POST fields (data to send)
$data = [
    "authToken" => $authToken,
];
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));

// Execute the cURL request
$response = curl_exec($ch);

// Check for cURL errors
if (curl_errno($ch)) {
    echo "cURL Error: " . curl_error($ch);
} else {
    // Decode the JSON response and store it in a variable
    $json_response = json_decode($response, true);

    // Store each response field in separate variables
    if (isset($json_response[0])) {
        $status = $json_response[0]["status"];
        $expireDateTimestamp = $json_response[0]["expireDate"];
        $expireDate = date("Y-m-d H:i:s", $expireDateTimestamp); // Convert timestamp to readable format
        $authTokenResponse = $json_response[0]["authToken"];
        $planId = $json_response[0]["activePlan"];
        $licensetype = $json_response[0]["licensetype"];

        $expireDateShow = date("d/m/Y", $expireDateTimestamp);

        // Check expiration status
        $currentDate = time(); // Current timestamp
        $expireDateInSeconds = $expireDateTimestamp; // Expiry timestamp

        if ($expireDateInSeconds < $currentDate) {
            // License expired
            $licenseCk = '<div class="col-lg-12 col-md-12 col-12">
    <div class="alert alert-info align-items-center mb-10 animated-border" role="alert" 
         style="border-radius: 3px;
    background: #ffd1e0 !important;
    color: #b4013e;border: 1px solid">
        <div class="w-100">
            <h6><i class="fa-solid fa-triangle-exclamation me-2"></i> License Expired</h6>
        </div>
        <div class="w-100 align-items-center">
            
            <span>Your plan has expired. You <b>can\'t upload</b> any new edition.</span>
        </div>
    </div>
</div>';
        } elseif ($expireDateInSeconds - $currentDate <= 7 * 24 * 60 * 60) {
            // License will expire within 7 days
            $licenseCk =
                '<div class="col-lg-12 col-md-12 col-12">
    <div class="alert alert-info align-items-center mb-10 animated-border" role="alert" 
         style="
border-radius: 3px;
    background: #ffeee0;
    color: #87430b; border: 1px solid">
        <div class="w-100">
            <h6><i class="fa-solid fa-triangle-exclamation me-2"></i> License Expiry Alert</h6>
        </div>
        <div class="w-100 align-items-center">
            
            <span>Your license will expire on <b><u>'. $expireDateShow .'</u></b>. Renew now!</span>
        </div>
    </div>
</div>
';
        } else {
            // License is valid
            $licenseCk = "";
        }

        // Initialize variables for storage and page_views for the matched plan
        $matchedStorage = null;
        $matchedPageViews = null;

        if (isset($planNameMapping[$planId])) {
            // If the plan ID exists in the mapping, store its values
            $matchedPlanName    = $planNameMapping[$planId];
            $matchedStorage     = $storageMapping[$planId];
            $matchedPageViews   = $pageViewsMapping[$planId];
        } else {
            //echo "No matching plan found for Plan ID: " . $planId . "\n";
        }
    } else {
        echo "No data found in the response.";
    }
}
// Close the cURL session
curl_close($ch);
?>

Function Calls

None

Variables

None

Stats

MD5 cb2f2afd301aa5fe843d214556337fb3
Eval Count 0
Decode Time 52 ms