-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile.php
More file actions
151 lines (100 loc) · 4.27 KB
/
Copy pathprofile.php
File metadata and controls
151 lines (100 loc) · 4.27 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?php
include 'inc/header.php';
Session::CheckSession();
?>
<?php
if (isset($_GET['id'])) {
$userid = preg_replace('/[^a-zA-Z0-9-]/', '', (int)$_GET['id']);
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['update'])) {
$updateUser = $users->updateUserByIdInfo($userid, $_POST);
}
if (isset($updateUser)) {
echo $updateUser;
}
?>
<div class="card ">
<div class="card-header">
<h3>User Profile <span class="float-right"> <a href="index.php" class="btn btn-primary">Back</a> </h3>
</div>
<div class="card-body">
<?php
$getUinfo = $users->getUserInfoById($userid);
if ($getUinfo) {
?>
<div style="width:600px; margin:0px auto">
<form class="" action="" method="POST">
<div class="form-group">
<label for="name">Your name</label>
<input type="text" name="name" value="<?php echo $getUinfo->name; ?>" class="form-control">
</div>
<div class="form-group">
<label for="username">Your username</label>
<input type="text" name="username" value="<?php echo $getUinfo->username; ?>" class="form-control">
</div>
<div class="form-group">
<label for="email">Email address</label>
<input type="email" id="email" name="email" value="<?php echo $getUinfo->email; ?>" class="form-control">
</div>
<div class="form-group">
<label for="mobile">Mobile Number</label>
<input type="text" id="mobile" name="mobile" value="<?php echo $getUinfo->mobile; ?>" class="form-control">
</div>
<?php if (Session::get("roleid") == '1') { ?>
<div class="form-group
<?php if (Session::get("roleid") == '1' && Session::get("id") == $getUinfo->id) {
echo "d-none";
} ?>
">
<div class="form-group">
<label for="sel1">Select user Role</label>
<select class="form-control" name="roleid" id="roleid">
<?php
if($getUinfo->roleid == '1'){?>
<option value="1" selected='selected'>Admin</option>
<option value="2">Editor</option>
<option value="3">User only</option>
<?php }elseif($getUinfo->roleid == '2'){?>
<option value="1">Admin</option>
<option value="2" selected='selected'>Editor</option>
<option value="3">User only</option>
<?php }elseif($getUinfo->roleid == '3'){?>
<option value="1">Admin</option>
<option value="2">Editor</option>
<option value="3" selected='selected'>User only</option>
<?php } ?>
</select>
</div>
</div>
<?php }else{?>
<input type="hidden" name="roleid" value="<?php echo $getUinfo->roleid; ?>">
<?php } ?>
<?php if (Session::get("id") == $getUinfo->id) {?>
<div class="form-group">
<button type="submit" name="update" class="btn btn-success">Update</button>
<a class="btn btn-primary" href="changepass.php?id=<?php echo $getUinfo->id;?>">Password change</a>
</div>
<?php } elseif(Session::get("roleid") == '1') {?>
<div class="form-group">
<button type="submit" name="update" class="btn btn-success">Update</button>
<a class="btn btn-primary" href="changepass.php?id=<?php echo $getUinfo->id;?>">Password change</a>
</div>
<?php } elseif(Session::get("roleid") == '2') {?>
<div class="form-group">
<button type="submit" name="update" class="btn btn-success">Update</button>
</div>
<?php }else{ ?>
<div class="form-group">
<a class="btn btn-primary" href="index.php">Ok</a>
</div>
<?php } ?>
</form>
</div>
<?php }else{
header('Location:index.php');
} ?>
</div>
</div>
<?php
include 'inc/footer.php';
?>