-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.php
66 lines (64 loc) · 3.01 KB
/
profile.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
64
65
66
<?php
include "inc/header.php";
include "lib/User.php";
Session::checkSession();
?>
<?php
if (isset($_GET['id'])) {
$userid = (int)$_GET['id'];
}
$user = new User();
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["update"])) {
$userUpdate = $user->userUpdatedata($userid, $_POST);
}
?>
<div class="row">
<div class="col-md-12">
<div class="panel-wrap">
<div class="pane-heading">
<h4>User Profile <span class="float-right"><strong>Wellcome ! </strong>
<?php
$username = Session::get("username");
if (isset($username)) {
echo $username;
}
?>
</span></h4>
</div>
<div class="panel-body">
<div style="max-width: 600px; margin: 0 auto; padding: 30px 0;">
<?php
if (isset($userUpdate)) {
echo $userUpdate;
}
?>
<?php
$userData = $user->getUserbyId($userid);
if ($userData) { ?>
<form action="" method="POST">
<div class="form-group">
<label for="firstname">Name</label>
<input class="form-control" type="text" name="name" value="<?php echo $userData->name; ?>">
</div>
<div class="form-group">
<label for="username">User Name</label>
<input class="form-control" type="text" name="username" value="<?php echo $userData->username; ?>">
</div>
<div class="form-group">
<label for="email">Email</label>
<input class="form-control" type="email" name="email" value="<?php echo $userData->email; ?>">
</div>
<?php
$sesid = Session::get("id");
if ($userid == $sesid) { ?>
<button type="submit" name="update" class="btn btn-success">Uptate</button>
<a href="changepassword.php?id=<?php echo $userid; ?>" class="btn btn-info">Change Password</a>
<?php } ?>
</form>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
<?php include "inc/footer.php" ?>