Viewing File: /home/quiczmwg/solixproperties.org/profile.php
<?php
session_start();
// Check if the user is logged in
if (!isset($_SESSION['userid'])) {
// Redirect to the login page if the user is not logged in
header("Location: login.php");
exit();
}
// Include header and topbar
include_once("include/header.php");
include_once("include/topbar.php");
include_once("search.php");
// Include database connection
include_once("_db.php");
// Fetch user details from the database
$userID = $_SESSION['userid'];
// Query to fetch user details
$query = "SELECT username, account_balance, email, created_at FROM user_login WHERE userid = ?";
$stmt = $conn->prepare($query);
$stmt->bind_param("s", $userID);
$stmt->execute();
$result = $stmt->get_result();
// Check if user exists
if ($result->num_rows > 0) {
$row = $result->fetch_assoc();
$username = $row['username'];
$accountBalance = $row['account_balance'];
$email = $row['email'];
$registrationDate = $row['created_at'];
} else {
// Handle case where user does not exist
$username = "User Not Found";
$accountBalance = 0;
$email = "";
$registrationDate = "N/A";
}
$stmt->close();
$conn->close();
?>
<div class="container">
<h1>Welcome to Your Profile</h1>
<!-- Profile card -->
<div class="card">
<div class="card-body">
<p class="text-muted">Personal information</p>
<div class="live-preview">
<input type="hidden" name="_token" value="2VQsxQeoioNKqSh7qENZrRradWW1jgTyTgttmBd9">
<div class="row">
<div class="col-md-6">
<div class="mb-3">
<label for="username" class="form-label">Username</label>
<input type="text" name="username" value="<?php echo $username; ?>" class="form-control" readonly>
</div>
</div>
<!--end col-->
<div class="col-md-6">
<div class="mb-3">
<label for="email" class="form-label">Email</label>
<input type="text" name="email" value="<?php echo $email; ?>" class="form-control" readonly>
</div>
</div>
<!--end col-->
<div class="col-md-6">
<div class="mb-3">
<label for="created_at" class="form-label">Registration Date</label>
<input type="text" name="created_at" value="<?php echo $registrationDate; ?>" class="form-control" readonly>
</div>
</div>
<!--end col-->
<div class="col-md-6">
<div class="mb-3">
<label for="account_balance" class="form-label">Account Balance</label>
<input type="text" name="account_balance" value="$<?php echo number_format($accountBalance, 2); ?>" class="form-control" readonly>
</div>
</div>
<!--end col-->
<div class="col-lg-12">
<div class="text-end">
<a href="deposit.php" class="btn btn-primary">Fund Account</a>
</div>
</div>
<!--end col-->
</div>
<!--end row-->
</div>
</div>
</div>
</div>
<?php include_once("include/footer.php"); ?>
Back to Directory
File Manager
<