-
Notifications
You must be signed in to change notification settings - Fork 0
/
loggedUser.php
executable file
·63 lines (52 loc) · 2.89 KB
/
loggedUser.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!-- content starts -->
<section class="my-3">
<div class="container justify-content-center bg-success-subtle shadow rounded p-3">
<h4>User Profile <span style="font-size:small"><a href="#edit" data-bs-toggle="modal" data-bs-target="#editProfile"><i class="fas fa-user-pen fa-fw"></i>Edit</a></span></h4>
<p>Name: <?php echo htmlspecialchars($user_info['first_name']); ?>
</p>
<p>username: <?php echo htmlspecialchars($user_info['username']); ?>
</p>
<p>Email: <?= $user_info['email']?></p>
</div>
<!--Edit Modal -->
<div class="modal fade" id="editProfile" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="editProfileLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="#">Update Information</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div>
<?php
// edit user (from logged user)
if(isset($_POST['submit'])){
$_POST['username'] = $_SESSION['username'];
if($u->updateUser($_POST)){
echo "User updated successfully";
header('Location: user.php');
}
else{
echo "User not updated";
header('Location: user.php');
}
}
?>
<form action="user.php" method="POST">
<label for="">First Name</label>
<input class="form-control py-2 my-2" type="text" name="first_name" id="" value="<?= $user_info['first_name'] ?>">
<label for="">Last Name</label>
<input class="form-control py-2 my-2" type="text" name="last_name" value="<?= $user_info['last_name'] ?>">
<label for="">Email</label>
<input class="form-control py-2 my-2" type="email" name= "email" value="<?= $user_info['email'] ?>">
<button class="form-control btn btn-secondary" type="submit" name="submit">Save</button>
</form>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
</section>