/* Decoded by unphp.net */ ?>query($query); if ($result && $result->num_rows > 0) { $row = $result->fetch_assoc(); $currentVersion = $row['version']; } else { $currentVersion = "Unknown"; } // 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"); $userId = $_SESSION['user_id']; $currentUsername = ""; // Retrieve user's current username $sql = "SELECT username FROM users WHERE id = ?"; $stmt = $conn->prepare($sql); if ($stmt) { $stmt->bind_param("i", $userId); $stmt->execute(); $stmt->bind_result($currentUsername); $stmt->fetch(); $stmt->close(); } else { $errorMessage = "Database error. Please try again later."; } if ($_SERVER['REQUEST_METHOD'] === 'POST') { $newUsername = $_POST['newUsername']; // 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."; $currentUsername = $newUsername; // Update the displayed username } else { $errorMessage = "Failed to update username. Error: " . $stmt->error; } $stmt->close(); } else { $errorMessage = "Database error. Please try again later."; } } $conn->close(); // Close the database connection $connection->close(); ?>