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(' hVTBbptAEL1b8j9MkSWwVOOekwarSrAaKWms2FEP UYQ2MDarYpbsL..
Decoded Output download
?><?php
session_start();
// Check if user is logged in
if (!isset($_SESSION['user_id'])) {
header("Location: ../login.php"); // Redirect to login page if not logged in
exit();
}
require_once "config.php"; // Include your database connection file
$newUsername = $_POST['newUsername'];
$userId = $_SESSION['user_id'];
// Update the username in the database
$sql = "UPDATE users SET username = ? WHERE id = ?";
$stmt = $conn->prepare($sql);
if ($stmt) {
$stmt->bind_param("si", $newUsername, $userId);
if ($stmt->execute()) {
$successMessage = "Username updated successfully.";
} else {
$errorMessage = "Failed to update username. Error: " . $stmt->error;
}
$stmt->close();
} else {
$errorMessage = "Database error. Please try again later.";
}
// Fetch the user's profile photo path from the database
$userId = $_SESSION['user_id'];
$sql = "SELECT profile_photo FROM users WHERE id = '$userId'";
$result = $connection->query($sql);
if ($result->num_rows > 0) {
$row = $result->fetch_assoc();
$_SESSION['profile_photo'] = $row['profile_photo']; // Update the session variable
}
$conn->close();
?><?
Did this file decode correctly?
Original Code
<? eval(gzinflate(base64_decode('
hVTBbptAEL1b8j9MkSWwVOOekwarSrAaKWms2FEP
UYQ2MDarYpbsLk2syv/emQVsXB+KxGGX2ffmzXvL
LPo6q/JqODBojFRlYqzQNhhfDgfDwXQK1zmmv0Cu
oTaoQRoo1GaDGchyOKDd4JM0Bm0wSpbxcnn78OPZ
58JEZv7LeAx/hgOgJ0eRoQ68O5UKSyQXEIZTApJl
SNze+BKI6REzqTG1YBW4b1CJDTJ1qWyflhHxQzZN
7rlPjW81nU1UmSJ4qSrXcuOQHfBtmRZ1hrBTtYZM
WPEqDAJVlcRG3cBaFsgwoxLfn6j7UmwRrmCULB6W
q2e/t+u/EOWIFd5mruJcdTe4p4qoEGyObnQOkzTx
uuuBoMxbQTje0+Lm2yp2hQaW8ep45Apm8PN7/BiD
ZMaZxw0Yu7VMzxomUaWxEhoDBuORsC2u5DB/t5pE
r7LMEioV28Az0vsMfcG0anQxBB86wEwi/MC0thgc
HW1Q6zSl1NzTy06xjq7t2qnPoC1Z10WxC70WeQ9Y
kAN9KNRa6R7QXJAnGUehQToMJISYSy/Ag7DT5Q53
2CeK00IZbHJywnnGd9PFwn0IYVEgr6zegdgI8q2g
JrRTsG8NnqNN84O/voFKK04SVLmivithc1hrtf3X
8v+lp8vEMr6Lr1cdatKgzh8f7tuY9FLht6C+S4dG
UxeHfDQZn0RvNerdISNtSprSSVTW20SrdwMRfDmm
hnYYpStas+BEGKPSoAtJT8NJo/6LO6nez/bdlexd
jva/A7+FluKVL6IbcJvto4Ez+lH9BQ==
'))); ?>
Function Calls
gzinflate | 1 |
base64_decode | 1 |
Stats
MD5 | 3a2d39340baf4e02f01af533ca512f3c |
Eval Count | 1 |
Decode Time | 50 ms |