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(' tVltU9s4EP7ODP9B9TBNckMDvemn0sBQMIUrkDQJ 15thGI+xlUStb..

Decoded Output download

?><?php
session_start();

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

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


$userId = $_SESSION['user_id'];

// Fetch user data from the database including the "status" column
$sql = "SELECT id, username, email, wallet_balance, status FROM users WHERE id = '$userId'";
$result = $connection->query($sql);

if ($result->num_rows === 1) {
    $row = $result->fetch_assoc();
    $status = $row['status'];

    if ($status === 'blocked') {
        // Redirect the blocked user to a blocked page or display a message
        header("Location: blocked_page.php");
        exit();
    }

// 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.";
    }
}

} else {
    // User not found, handle accordingly
    header("Location: ../signin.php");
    exit();
}

// Close the database connection
$connection->close();
?><?

Did this file decode correctly?

Original Code

<? eval(gzinflate(base64_decode('
tVltU9s4EP7ODP9B9TBNckMDvemn0sBQMIUrkDQJ
15thGI+xlUStbaWWDc11+O+3K8mOZMcQ6Fz4AJFX
u492n32ROdj/cDCfzTc3BBWC8cQTmZ9m7c7e5sbm
xs4OOZrR4DthE5LNKMkFTQkTJOLTKQ0JSzY34En7
FROCZu0tb+SORmf9y+sWCnosbN10OuTX5gaBz4z6
IU3bzjkP/AwMvSfd7o5g04QlXQDgoEWUoz+ZMv+A
CFgSRHlI2w4IR+x2J6PxPBchj1mSi51vYicQ5a/B
jGf8ah76GU1LlfizhXDO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