-
Notifications
You must be signed in to change notification settings - Fork 1
/
wbmemberadmin.php
262 lines (233 loc) · 8.39 KB
/
wbmemberadmin.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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<?php
session_start();
include 'config.php';
if (!isset($_SESSION['memno'])) {
header("location:wblogin.php");
}
$auth = $_SESSION['memno'];
$myauth = $conn->query("select Page, PageName, PageLink from AuthMatrix a, Pageindex b where a.MemNo = '{$_SESSION[('memno')]}' and a.Page=b.PageNo order by PageName;");
$BaseYr=2023;
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Profile</title>
<link rel="stylesheet" type="text/css" href="CSS/StylesMain.css">
<link rel="stylesheet" type="text/css" href="CSS/StylesForm.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0">
<script type="text/javascript" src="Javascript/ScriptMain.js"></script>
</head>
<body>
<?php include 'sidebar.php' ?>
<h2>Member Admin</h2>
<?php
$query ="SELECT Designation FROM desigmast";
$result = $conn->query($query);
?>
<?php
$pageno = 3;
$error = "";
$permission = "";
if ($_REQUEST['btn_submit']=="Get Details") {
// echo $otpcounter;
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$mysubmit=0;
if ($conn->query("select MemNo from AuthMatrix where BINARY MemNo = $auth and BINARY Page = $pageno ") ->num_rows == 1) {
$mysubmit = 1;
$permission = "You are authorized to perform this action.";
} else{
$mysubmit = 0;
$permission = "You are not authorized to perform this action.";
}
$qmemno = $_POST['qmemno'];
//$mysubmit = $_POST['mysubmit'];
if ($mysubmit == 1) {
$qmember = $conn->query("select MemNo, Name, TO_CHAR(DOB, 'DD MONTH YYYY') Dt, Sex, Mobile, Email, Designation, PostedAt, Company from profiles where MemNo = '$qmemno' ;")->fetch_assoc();
$qmemname = $qmember['Name'];
$qdesignation = $qmember['Designation'];
$qpostedat = $qmember['PostedAt'];
$qcompany = $qmember['Company'];
$qdesig = $conn->query(" select * from desigmast where Company = '$qcompany'");
$qposted = $conn->query(" select * from postingmast where Company = '$qcompany'");
$permission = "You are authorized to perform this action.";
}
}
}
if ($_REQUEST['btn_submit']=="Update Designation") {
//echo "a";
//echo $mysubmit;
if ($_SERVER['REQUEST_METHOD'] == "POST") {
//echo "b";
$mysubmit = $_POST['mysubmit'];
//echo $mysubmit;
$qmemno = $_POST['qmemno'];
$edesignation = $_POST['edesignation'];
//echo $mysubmit;
//$mysubmit = 0;
if ($mysubmit == 1) {
$rdesi = $_POST['rdesignation'];
$dt = date('d/m/Y h:i:s a', time());
$modidesig = $conn->query("UPDATE profiles SET Designation = '$rdesi' WHERE MemNo = '$qmemno' ");
$modidesig = $conn->query("INSERT INTO wblog (KeyNo, PageNo, Item, Value1, Value2, User, Tdate) VALUES ('$qmemno', '$pageno', 'Desig', '$edesignation', '$rdesi', '$auth', '$dt'); ");
$permission = "Success!! - Designation updated";
$mysubmit = 0;
//echo $mysubmit;
$qmemno=NULL;
;
} else {
// $error = "Incorrect Credentials";
$permission = "You are not authorized to perform this action.";
}
}
}
if ($_REQUEST['btn_submit']=="Update Posted At") {
//echo "a";
//echo $mysubmit;
if ($_SERVER['REQUEST_METHOD'] == "POST") {
//echo "b";
$mysubmit = $_POST['mysubmit'];
//echo $mysubmit;
$qmemno = $_POST['qmemno'];
//echo $qmemno;
$epostedat = $_POST['epostedat'];
//echo $epostedat;
//echo $mysubmit;
//$mysubmit = 0;
if ($mysubmit == 1) {
$rposted = $_POST['rpostedat'];
//echo $rposted;
$dt = date('d/m/Y h:i:s a', time());
$modiposted = $conn->query("UPDATE profiles SET PostedAt = '$rposted' WHERE MemNo = '$qmemno' ");
$modiposted = $conn->query("INSERT INTO wblog (KeyNo, PageNo, Item, Value1, Value2, User, Tdate) VALUES ('$qmemno', '$pageno', 'Posting', '$epostedat', '$rposted', '$auth', '$dt') ");
$permission = "Success!! - Posting updated";
$mysubmit = 0;
//echo $mysubmit;
$qmemno=NULL;
;
} else {
// $error = "Incorrect Credentials";
$permission = "You are not authorized to perform this action.";
}
}
}
?>
<div class="content">
<h1>Member Admin</h1>
<div class="form-container">
<form
method="post"
action="<?php
echo htmlspecialchars($_SERVER['PHP_SELF'])
;?>"
>
<div>
<input
type="text"
name="memname"
id="memname"
value="<?php echo $permission; ?>"
readonly="true"
>
<?php echo $error ?>
</div>
</form>
<form
method="post"
action="<?php
echo htmlspecialchars($_SERVER['PHP_SELF'])
;?>"
>
<input type="hidden" name="mysubmit" value="<?php echo $mysubmit; ?>" />
<label for="Membership #">Membership #</label>
<input
type="text"
name="qmemno"
id="qmemno"
value="<?php echo $qmemno; ?>"
>
<input type="submit" name="btn_submit" value="Get Details">
</div>
<div>
<label for="memname">Member Name</label>
<input
type="text"
name="memname"
id="memname"
value="<?php echo $qmemname; ?>"
readonly="true"
style="background-color:#FCF5D8;"
>
<label for="company">Company</label>
<input
type="text"
name="company"
id="company"
value="<?php echo $qcompany; ?>"
readonly="true"
style="background-color:#FCF5D8;"
>
<div>
<label for="edesignation">Existing Designation</label>
<input
type="text"
name="edesignation"
id="edesignation"
value="<?php echo $qdesignation; ?>"
readonly="true"
style="background-color:#FCF5D8;"
>
<label for="rdesignation">Revised Designation</label>
<select name="rdesignation" id="rdesignation">
<option value="" hidden></option>
<?php while ($qdes = $qdesig->fetch_assoc()) { ?>
<option value="<?php echo $qdes['Designation']; ?>"><?php echo $qdes['Designation']; ?></option>
<?php } ?>
</select>
<input type="submit" name="btn_submit" value="Update Designation">
<?php echo $error ?>
</div>
</div>
<div>
<label for="epostedat">Existing Posted At</label>
<input
type="text"
name="epostedat"
id="epostedat"
value="<?php echo $qpostedat; ?>"
readonly="true"
style="background-color:#FCF5D8;"
>
<label for="rpostedat">Revised Posted At</label>
<select name="rpostedat" id="rpostedat">
<option value="" hidden></option>
<?php while ($qpost = $qposted->fetch_assoc()) { ?>
<option value="<?php echo $qpost['PostedAt']; ?>"><?php echo $qpost['PostedAt']; ?></option>
<?php } ?>
</select>
<input type="submit" name="btn_submit" value="Update Posted At">
<?php echo $error ?>
</div>
</form>
</div>
</div>
<div class="ad-column">
<?php
$adType = "desktop";
include 'ad.php';
?>
</div>
<div class="ad-column">
<?php
$adType = "desktop";
include 'ad.php';
?>
</div>
<script>
if ( window.history.replaceState ) {
window.history.replaceState( null, null, window.location.href );
}
</script>
</body>
</html>