<?php include("header.php");?>
<div class="container mt-5">
<div class="row">
<div class="col-md-4">
<div class="card">
<div class="card-body text-center">
<img src="assets/images/faces/face8.jpg" class="rounded-circle mb-3" alt="Profile Picture">
<h4><?php echo $name;?></h4>
<p>Email: <?php echo $email;?></p>
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#changePasswordModal">
Change Password
</button>
</div>
</div>
</div>
<div class="col-md-8">
<div class="card">
<div class="card-body">
<h4 class="card-title text-secondary">Your information</h4>
<div class="table-responsive">
<table class="table table-striped border">
<tbody>
<tr>
<td>IP Address:</td>
<td class="text-info"><?php
function getUserIP() {
if (isset($_SERVER['HTTP_CLIENT_IP']) && !empty($_SERVER['HTTP_CLIENT_IP'])) {
// Check if IP is from shared internet
return $_SERVER['HTTP_CLIENT_IP'];
} elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
// Check if IP is passed from a proxy
return $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
// Default: return the remote IP address
return $_SERVER['REMOTE_ADDR'];
}
}
$user_ip = getUserIP();
echo $user_ip;
?></td>
</tr>
<tr>
<td>Name</td>
<td><?php echo $name; ?></td>
</tr>
<tr>
<td>Email</td>
<td><?php echo $email; ?></td>
</tr>
<tr>
<td>Phone</td>
<td><?php echo $phone; ?></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Change Password Modal -->
<div class="modal fade" id="changePasswordModal" tabindex="-1" aria-labelledby="changePasswordModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="changePasswordModalLabel">Change Password</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form id="changePasswordForm" action="pages/change_password.php" method="POST">
<div class="mb-3">
<label for="currentPassword" class="form-label">Current Password</label>
<input type="password" class="form-control" id="currentPassword" name="currentPassword" placeholder="Enter current password" required>
</div>
<div class="mb-3">
<label for="newPassword" class="form-label">New Password</label>
<input type="password" class="form-control" id="newPassword" name="newPassword" placeholder="Enter new password" required>
</div>
<div class="mb-3">
<label for="confirmPassword" class="form-label">Confirm New Password</label>
<input type="password" class="form-control" id="confirmPassword" name="confirmPassword" placeholder="Confirm new password" required>
</div>
<button type="submit" class="btn btn-success" onclick="return confirm('Do you want to update password?')">Update Password</button>
</form>
</div>
</div>
</div>
</div>
<?php include("footer.php");?>