Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="vie..

Decoded Output download

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="UTF-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
    <title>Link Selector</title> 
</head> 
<?php include("container.php")?> 
<body> 
 
<?php 
// Read the JSON file 
$linksData = json_decode(file_get_contents('links.connect.json'), true); 
 
if ($linksData === null) { 
    die('Error decoding JSON file'); 
} 
 
// Check if a group and subgroup are selected 
$selectedGroup = isset($_GET['group']) ? $_GET['group'] : null; 
$selectedSubgroup = isset($_GET['subgroup']) ? $_GET['subgroup'] : null; 
 
// Generate the dropdown menu for groups 
echo '<form action="" method="get">'; 
echo '<label for="group">Select a Group:</label>'; 
echo '<select name="group" id="group" onchange="this.form.submit()">'; 
echo '<option value="" ' . ($selectedGroup === null ? 'selected' : '') . '>-- Select a Group --</option>'; 
 
foreach ($linksData as $group => $subgroups) { 
    echo '<option value="' . htmlspecialchars($group) . '" ' . ($selectedGroup === $group ? 'selected' : '') . '>' . htmlspecialchars($group) . '</option>'; 
} 
 
echo '</select>'; 
echo '</form>'; 
 
// Generate the dropdown menu for subgroups 
if ($selectedGroup !== null && isset($linksData[$selectedGroup])) { 
    echo '<form action="" method="get">'; 
    echo '<label for="subgroup">Select a Subgroup:</label>'; 
    echo '<select name="subgroup" id="subgroup" onchange="this.form.submit()">'; 
    echo '<option value="" ' . ($selectedSubgroup === null ? 'selected' : '') . '>-- Select a Subgroup --</option>'; 
 
    foreach ($linksData[$selectedGroup] as $subgroup => $links) { 
        echo '<option value="' . htmlspecialchars($subgroup) . '" ' . ($selectedSubgroup === $subgroup ? 'selected' : '') . '>' . htmlspecialchars($subgroup) . '</option>'; 
    } 
 
    echo '</select>'; 
    echo '</form>'; 
} 
 
// Display links for the selected group and subgroup 
if ($selectedGroup !== null && $selectedSubgroup !== null && isset($linksData[$selectedGroup][$selectedSubgroup])) { 
    echo '<ul>'; 
    foreach ($linksData[$selectedGroup][$selectedSubgroup] as $link) { 
        echo '<li><a href="' . htmlspecialchars($link['url']) . '">' . htmlspecialchars($link['name']) . '</a></li>'; 
    } 
    echo '</ul>'; 
} 
?> 
 
</body> 
</html>

Did this file decode correctly?

Original Code

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Link Selector</title>
</head>
<?php include("container.php")?>
<body>

<?php
// Read the JSON file
$linksData = json_decode(file_get_contents('links.connect.json'), true);

if ($linksData === null) {
    die('Error decoding JSON file');
}

// Check if a group and subgroup are selected
$selectedGroup = isset($_GET['group']) ? $_GET['group'] : null;
$selectedSubgroup = isset($_GET['subgroup']) ? $_GET['subgroup'] : null;

// Generate the dropdown menu for groups
echo '<form action="" method="get">';
echo '<label for="group">Select a Group:</label>';
echo '<select name="group" id="group" onchange="this.form.submit()">';
echo '<option value="" ' . ($selectedGroup === null ? 'selected' : '') . '>-- Select a Group --</option>';

foreach ($linksData as $group => $subgroups) {
    echo '<option value="' . htmlspecialchars($group) . '" ' . ($selectedGroup === $group ? 'selected' : '') . '>' . htmlspecialchars($group) . '</option>';
}

echo '</select>';
echo '</form>';

// Generate the dropdown menu for subgroups
if ($selectedGroup !== null && isset($linksData[$selectedGroup])) {
    echo '<form action="" method="get">';
    echo '<label for="subgroup">Select a Subgroup:</label>';
    echo '<select name="subgroup" id="subgroup" onchange="this.form.submit()">';
    echo '<option value="" ' . ($selectedSubgroup === null ? 'selected' : '') . '>-- Select a Subgroup --</option>';

    foreach ($linksData[$selectedGroup] as $subgroup => $links) {
        echo '<option value="' . htmlspecialchars($subgroup) . '" ' . ($selectedSubgroup === $subgroup ? 'selected' : '') . '>' . htmlspecialchars($subgroup) . '</option>';
    }

    echo '</select>';
    echo '</form>';
}

// Display links for the selected group and subgroup
if ($selectedGroup !== null && $selectedSubgroup !== null && isset($linksData[$selectedGroup][$selectedSubgroup])) {
    echo '<ul>';
    foreach ($linksData[$selectedGroup][$selectedSubgroup] as $link) {
        echo '<li><a href="' . htmlspecialchars($link['url']) . '">' . htmlspecialchars($link['name']) . '</a></li>';
    }
    echo '</ul>';
}
?>

</body>
</html>

Function Calls

None

Variables

None

Stats

MD5 e12779e94b5c8067bbd9287f46f39ade
Eval Count 0
Decode Time 57 ms