This repository was archived by the owner on Nov 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUpdateProfile.php
183 lines (182 loc) · 9.96 KB
/
UpdateProfile.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
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<?php
include('session.php');
include('SQLFunctions.php');
$table = 'users_enc';
$q = $_SESSION['userID'];
$ARole = $_SESSION['role'];
$title = "SVBX - Update Profile";
$Loc = "SELECT Username, Role, firstname, lastname, Email, Company, SecQ, SecA FROM $table WHERE UserID = ".$q;
include('filestart.php');
$link = f_sqlConnect();
$sql1 = "SELECT SecQID, SecQ FROM secQ ORDER BY SecQID";
$list1 = mysqli_query($link,$sql1);
?>
<header class="container page-header">
<h1 class="page-title">Update User Information</h1>
</header>
<?php if($stmt = $link->prepare($Loc)) {
$stmt->execute();
$stmt->bind_result($Username, $Role, $firstname, $lastname, $Email, $Company, $SecQ, $SecA);
while ($stmt->fetch()) {
echo "
<div class='container main-content'>
<FORM action='UpdateProfileCommit.php' method='POST' onsubmit='' />
<input type='hidden' name='userID' value='$q'>
<table class='table'>
<tr class='usertr'>
<th class='userth'>First name:</td>
<td class='usertd'>
<input type='text' name='firstname' maxlength='25' required value='$firstname'/>
</td>
</tr>
<tr class='usertr'>
<th class='userth'>Last name:</td>
<td class='usertd'>
<input type='text' name='lastname' maxlength='25' required value='$lastname'/>
</td>
</tr>
<tr class='usertr'>
<th class='userth'>Email Address:</td>
<td class='usertd'>
<input type='text' name='Email' maxlength='55' required value='$Email'/>
</td>
</tr>
<tr class='usertr'>
<th class='userth'>Username:</td>
<td class='usertd'>
<input type='text' name='username' maxlength='25' required value='$Username'/>
</td>
</tr>
<tr class='usertr'>
<th class='userth'>Company:</td>
<td class='usertd'>
<input type='text' name='Company' maxlength='25' required value='$Company'/>
</td>
</tr>
<tr class='usertr'>
<th class='userth'>Update Security Question:</td>
<td class='usertd'><select name='SecQ' value='".$SecQ."' id='defdd' style='min-width: 400px'></option>
<option value=''></option>";
if(is_array($list1) || is_object($list1)) {
foreach($list1 as $row) {
echo "<option value='$row[SecQID]'";
if($row['SecQID'] == $SecQ) {
echo " selected>$row[SecQ]</option>";
} else { echo ">$row[SecQ]</option>";
}
}
}
echo "
</tr>
<tr class='usertr'>
<th class='userth'>Update Security Answer:</td>
<td class='usertd'>
<input type='text' name='SecA' maxlength='25' required value='".$SecA."'/>
</td>
</tr>
<tr class='usertr'>
<th class='userth'>Password:</td>
<td class='usertd'>
<input type='password' name='Password' maxlength='25' value=''/><br />
<i>only complete if you want to change a users password</i>
</td>
</tr>
<tr class='usertr'>
<th class='userth'>Confirm Password:</td>
<td class='usertd'>
<input type='password' name='ConPwd' maxlength='25' value=''/><br />
<i>confirm new password</i>
</td>
</tr>";
if($ARole >= 100) {
echo "
<tr class='usertr'>
<th class='userth' rowspan='4'>Role:</td>
<td class='usertd'>
<input type='radio' name=['role'] value='S'";
if($ARole== 'S') {
echo ' checked';
} else {
}
echo "/>Super Admin
</td>
</tr>
<tr class='usertr'>
<td class='usertd'>
<input type='radio' name=['role'] value='A'";
if($Role== 'A') {
echo ' checked';
} else {
}
echo "/>Administrator
</td>
</tr>
<tr class='usertr'>
<td class='usertd'>
<input type='radio' name=['role'] value='U'";
if($Role== 'U') {
echo ' checked';
} else {
}
echo "/>User
</td>
</tr>
<tr class='usertr'>
<td class='usertd'>
<input type='radio' name=['role'] value='V'";
if($Role== 'V') {
echo ' checked';
} else {
}
echo "/>Read Only
</td>
</tr>";
} elseif($ARole == 'A') {
echo "
<tr class='usertr'>
<th class='userth' rowspan='3'>Role:</td>
<td class='usertd'>
<input type='radio' name=['role'] value='A'";
if($Role== 'A') {
echo ' checked';
} else {
}
echo "/>Administrator
</td>
</tr>
<tr class='usertr'>
<td class='usertd'>
<input type='radio' name=['role'] value='U'";
if($Role== 'U') {
echo ' checked';
} else {
}
echo "/>User
</td>
</tr>
<tr class='usertr'>
<td class='usertd'>
<input type='radio' name=['role'] value='V'";
if($Role== 'V') {
echo ' checked';
} else {
}
echo "/>Read Only
</td>
</tr>";
} else {
}
echo "
</table>
<input type='submit' value='submit' class='btn btn-primary btn-lg'/>
<input type='reset' value='reset' class='btn btn-primary btn-lg' />
</FORM>";
}
echo "</div>";
} else {
echo '<br>Unable to connect';
echo '<br />SQL: '.$Loc;
echo '<br />UserID: '.$q;
exit();
}
include('fileend.php') ?>