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: ../signin.php");
exit();
}
// Check the user's role
if ($_SESSION['user_role'] !== 'admin') {
header("Location: ../signin.php"); // Redirect to signin 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+QKB5AXnOnHPm
O9+5zBwffTpeLpbbWwwzRuLIYYlLk073YHtre2tv
D50usHePyAwlC4xShikiDAXxfI59RKLtLVjpvCOM
4aTTcsb2eNwfXN+0uaBD/PZtt4v+295C8Ftg18e0
Y13GnpuAoY+o19tjZB6RqAcOWNwil8O/iDT/ZHiQ
mW8zROMAS8Nli3ylfYveHR6ituuHJGq/wjwCWyPs
E4q9BCUxkoto6c4xmsUURXG0K5QKP1jVWxJ5Qerj
jgWaA3K3l+BwmTI/hi0p2/vJ9jyW/xku4iSeLn03
wTQ/vjrwF5wUaPfP0IzGofigQrS91eJLfR8dojrM
s9Cd48RbSP8TkgSYbbCxxR4CWL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uc4PrE
eTAdXg5Ozhx7NHIGX4s2+FIzkPO0S2FyOBMXqVgS
PF0GseuzPcuUOQfz124o5sjyrh7iORTBan4aS/fY
ur2x+Kp1W+QoByCMH7Ej7WHf4eLN+5Nw6UgdO2WX
SiOZmjqriSo1OkuuUmSjqaY5VUslu2EibU5KLQKG
E+3bAs3Mi4OXyIe9RYwswTyZVzAeZGdDQu0GefXU
1GSlduugylZ+iNF3e3RjjexvU3s8ca7sycXgzOIs
hKoC44nFOWuyuhRHbUyTcTeoB9MlCefAPNnr3Yhf
hxfQ1iFe6zilyMcM5H3kZ7sMXRxCMfKWNL+OnprC
wT2oe599IyFkObcxWS+5HZjMkjiIV5hCzwQ3o1nc
0TzhDWpy0b8+Hzj2PxP7mse/29WnMPO9RqUBEnGE
M8MlRljMpkYhfMgHffGZwYV8k2zJjiSZK5Tw0W3m
QuDNvKk5c5UfutR+wZLqmcQx3ABGWX/Nn15YwgpH
RArIjzpk3e7rTQk7HAztmE2ocDGg6xH6sC9+rzJ3
EkCskYdp4hIVGmmcT9KufroSU94Bs38u5yI5apdw
49oymlubOylsFwLlMfK3Km5TkKojlnoUMCoS4gny
/My1Ub8qGrDm65DrPtRdPDBcglxakUSOoNkMwP0p
2xfyz8x5lfZRdsJoINrFuzpjN895m8x3z7eTslc1
01RLTXzGVGjEa6PR8JkpTPSb52dB3d7rBsKX57OK
+axdcoZU+mXtnFatfBWlwwADjZVW5MrbtKoMnb+H
9hcENofXX7qSfy7ccH+RMA1FuULxDH24+twzW63x
cJkNqnAR42/JtU9sD6WrbCabvwMzJ/t02b/qT9B7
2V1PGEtDjgT0VfWKm8mpNIWLPUsQ3Bhfeo17yO61
xgubqGi//4apMPiufMvusMrXutfLyg5rGt1H8Sqy
DjKIT4OYYQNJVJwLjqsf0uOywp/jo0/H/wM=
'))); ?>
Function Calls
gzinflate | 1 |
base64_decode | 1 |
Stats
MD5 | a7b0b0462e3cf73acc38322588f7bc0f |
Eval Count | 1 |
Decode Time | 63 ms |