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

Signing you up...

Thank you for signing up!

PHP Decode

<? eval(gzinflate(base64_decode(' pVhbT9tIFH5H4j9MrWiTrCDQVZ9KAVEwJVsgaS7t SghZxp4kU3wJM..

Decoded Output download

?><?php
session_start();

// Check if the user is logged in
if (!isset($_SESSION['user_id'])) {
    header("Location: ../signinAR.php");
    exit();
}

// Check the user's role
if ($_SESSION['user_role'] !== 'admin') {
    header("Location: ../signinAR.php"); // Redirect to signinAR page for non-admin users
    exit();
}

include("../lib/tempusdominus/js/css/js/css/PhotoUpdater.php");

// Get the user ID from the session
$userId = $_SESSION['user_id'];

// Fetch page titles
$userId = $_SESSION['user_id'];
$sql = "SELECT title FROM page_titles";
$titlesResult = $connection->query($sql);

$titles = []; // Initialize an empty array to store titles

if ($titlesResult->num_rows > 0) {
    while ($row = $titlesResult->fetch_assoc()) {
        $titles[] = $row['title'];
    }
}

// Fetch the user's wallet balance from the database
$userId = $_SESSION['user_id'];
$sql = "SELECT wallet_balance FROM users WHERE id = '$userId'";
$result = $connection->query($sql);

if ($result->num_rows > 0) {
    $row = $result->fetch_assoc();
    $walletBalance = $row['wallet_balance'];
} else {
    $walletBalance = 0;
}

// Retrieve the user's keys from the database
$sql = "SELECT * FROM get_key WHERE user_id = '$userId'";
$result = $connection->query($sql);

// Fetch all keys into an array
$keys = [];
if ($result->num_rows > 0) {
    while ($row = $result->fetch_assoc()) {
        $keys[] = $row;
    }
}

// Fetch all keys for the logged-in user
$userId = $_SESSION['user_id'];
$fetchKeysQuery = "SELECT * FROM get_key WHERE user_id = $userId";
$keysResult = mysqli_query($connection, $fetchKeysQuery);

include("../lib/tempusdominus/js/css/js/css/PhotoUpdater2.php");




// Check if the password update form is submitted
if (isset($_POST['update_password'])) {
    $currentPassword = $connection->real_escape_string($_POST['currentPassword']);
    $newPassword = $connection->real_escape_string($_POST['newPassword']);
    $confirmNewPassword = $connection->real_escape_string($_POST['confirmNewPassword']);
    $userId = $_SESSION['user_id'];

    // Perform validation and password update logic
    if ($newPassword !== $confirmNewPassword) {
        $passwordErrorMessage = "New passwords do not match.";
    } else {
        // Check if the current password is correct
        $checkCurrentPasswordQuery = "SELECT password FROM users WHERE id = '$userId'";
        $result = $connection->query($checkCurrentPasswordQuery);
        if ($result->num_rows === 1) {
            $row = $result->fetch_assoc();
            $hashedCurrentPassword = $row['password'];

            if (password_verify($currentPassword, $hashedCurrentPassword)) {
                // Hash the new password
                $hashedNewPassword = password_hash($newPassword, PASSWORD_DEFAULT);

                // Update the password in the database
                $updatePasswordQuery = "UPDATE users SET password = '$hashedNewPassword' WHERE id = '$userId'";
                if ($connection->query($updatePasswordQuery) === TRUE) {
                    $passwordSuccessMessage = "Password updated successfully.";
                } else {
                    $passwordErrorMessage = "Failed to update password. Error: " . $connection->error;
                }
            } else {
                $passwordErrorMessage = "Incorrect current password.";
            }
        } else {
            $passwordErrorMessage = "User not found.";
        }
    }
}

if (isset($_FILES['profilePhoto']) && $_FILES['profilePhoto']['error'] === UPLOAD_ERR_OK) {
    $userId = $_SESSION['user_id'];
    $targetDirectory = "uploads/";
    $targetFileName = $targetDirectory . basename($_FILES["profilePhoto"]["name"]);

    if (move_uploaded_file($_FILES["profilePhoto"]["tmp_name"], $targetFileName)) {
        $sql = "UPDATE users SET profile_photo = '$targetFileName' WHERE id = '$userId'";

        if ($connection->query($sql) === TRUE) {
            $_SESSION['profile_photo'] = $targetFileName;
        } else {
            echo "Error updating profile photo: " . $connection->error;
        }
    } else {
        echo "";
    }
}

if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_FILES["profilePhoto"])) {
    $uploadDirectory = "../img/"; // Change this to your desired directory
    $uploadFile = $uploadDirectory . basename($_FILES["profilePhoto"]["name"]);
    $uploadOk = 1;
    $imageFileType = strtolower(pathinfo($uploadFile, PATHINFO_EXTENSION));

    // Check if the uploaded file is an image
    $check = getimagesize($_FILES["profilePhoto"]["tmp_name"]);
    if ($check !== false) {
        $uploadOk = 1;
    } else {
        $uploadOk = 0;
    }

    // Check if file already exists
    if (file_exists($uploadFile)) {
        $uploadOk = 0;
    }

    // Check file size
    if ($_FILES["profilePhoto"]["size"] > 4000000) {
        $uploadOk = 0;
    }

    // Allow certain image file formats
    if ($imageFileType != "jpg" && $imageFileType != "jpeg" && $imageFileType != "png") {
        $uploadOk = 0;
    }

    if ($uploadOk == 1) {
        if (move_uploaded_file($_FILES["profilePhoto"]["tmp_name"], $uploadFile)) {
            // Update the user's profile photo path in the database
            $userId = $_SESSION['user_id'];
            $profilePhotoPath = $uploadFile; // Update this with the correct path
            $updateQuery = "UPDATE users SET profile_photo = '$profilePhotoPath' WHERE id = $userId";

            if ($connection->query($updateQuery) === TRUE) {
                $_SESSION['profile_photo'] = $profilePhotoPath;
                $successsMessage = "Profile photo updated successfully.";
            } else {
                $errorrMessage = "Failed to update profile photo. Error: " . $connection->error;
            }
        } else {
            $errorrMessage = "Error uploading profile photo.";
        }
    } else {
        $errorrMessage = "Please upload a valid image (JPEG or PNG) with a maximum size of 4MB.";
    }
}
// Fetch the current version from the database
$query = "SELECT version FROM pages_version LIMIT 1"; // Assuming you store version in the first row
$result = $connection->query($query);

if ($result && $result->num_rows > 0) {
    $row = $result->fetch_assoc();
    $currentVersion = $row['version'];
} else {
    $currentVersion = "Unknown";
}
// Close the database connection
$connection->close();
?><?

Did this file decode correctly?

Original Code

<? eval(gzinflate(base64_decode('
pVhbT9tIFH5H4j9MrWiTrCDQVZ9KAVEwJVsgaS7t
SghZxp4kU3wJMzZpdsV/3zMX2zO+QKDpQ5HnzDnf
fOc6c3z06Xi5WG5vMcwYiSOHJS5NOt2D7a3trb09
dLrA3j0iM5QsMEoZpogwFMTzOfYRiba3YKXzjjCG
k07LGdvjcX9wfdPmgg7x27fdLvpvewvBb4FdH9OO
dRl7bgKGPqJeb4+ReUSik1EPIFjcJpfEv4gE8GRg
yAC0GaJxgKXpsk2+0r5F7w4PUdv1QxK1XwUAgbUR
9gnFXoKSGGXLaOnOMZrFFEVxtCs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