-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheditstuprofile.php
267 lines (238 loc) · 8.62 KB
/
editstuprofile.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
263
264
265
266
267
<?php
$title="Edit Profile | Taalem";
require_once 'header.php';
if (!isset($_SESSION['regid'])) {
header("Location: index.php");
}
if ($_SESSION['usertype'] != "student") {
header("Location: index.php");
}
$dc = new Dataclass();
$msg;
$upst;
$regid = $_SESSION['regid'];
$username = $_SESSION['username'];
$usertype = $_SESSION['usertype'];
include 'inc/studeditdata.php';
$getuserq = "select * from student where regid=$regid";
$getdate = "select regdate from register where regid=$regid";
$userd = $dc->getRow($getuserq);
$regdt = $dc->getRow($getdate);
$getcityq = "select cityid, cityname from city";
$city = $dc->getTable($getcityq);
$namear = explode(" ", $userd['name']);
?>
<div class="titlepage">
<div class="row">
<div class="col-md-6">
<h1><?= $username ?></h1>
</div>
<div class="col-md-6 text-right">
<a href="profile.php?id=<?= $regid ?>" class="btn btn-custom">View Profile</a>
</div>
</div>
</div>
<div class="container mt-5">
<div class="row text-center">
<div class="col-md-6 offset-md-3">
<?php if (isset($msg) and $upst == false): ?>
<div class="alert alert-danger" role="alert">
<?= $msg ?>
</div>
<?php endif ?>
<?php if (isset($msg) and $upst == true): ?>
<div class="alert alert-success" role="alert">
<?= $msg ?>
</div>
<?php endif ?>
</div>
</div>
<div class="row inspro">
<div class="col-md-2 stimg">
<img class="rounded-circle wow rollIn" src="<?= $dc->getDp($regid,$usertype) ?>">
<div class="edupload">
<a href="#" data-toggle="modal" data-target="#exampleModalLong"><i class="fa fa-upload" aria-hidden="true"></i></a>
</div>
</div>
<div style="border-bottom:5px solid #676767;width:750px;border-radius: 2px;">
<h3 class="mt-5 wow flipInX" style="font-weight: bold;font-size: 32px;"><?php echo $namear[0]." ".$namear[1]; ?></h3>
<h5 class="wow flipInX text-muted">Register Since <?= date('Y',strtotime($regdt['regdate'])); ?> <br/> <i class="fas fa-transgender"></i>
<?php
if ($userd['gender'] == 'm') {
echo "Male";
}
else
{
echo "Female";
}
?>
</h5>
</div>
</div>
<div class="row">
<div class="col-md-2">
</div>
<div class="col-md-10 mt-3">
<div style="width:750px;">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#personal">Personal Detail</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#aboutme">About Me</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#changepwd">Change Password</a>
</li>
</ul>
</div>
<div class="tab-content">
<div id="personal" class="container tab-pane active"><br>
<form action="" method="post" onsubmit="return userRegVal()">
<div class="form-group">
<div class="row">
<div class="col-md-5">
<label for="">First Name</label>
<input type="text" name="fname" id="fname" class="form-control" value="<?= $namear[0] ?>" required />
</div>
<div class="col-md-5">
<label for="">Last Name</label>
<input type="text" name="lname" id="lname" class="form-control" value="<?= $namear[1] ?>" required />
</div>
</div>
<div class="row mt-2">
<div class="col-md-10">
<label for="">Address</label><br>
<textarea name="address" id="" cols="40" rows="4" style="width: 100%;border-radius: 5px;padding:10px;"><?= $userd['address'] ?></textarea>
</div>
</div>
<div class="row mt-2">
<div class="col-md-5">
<label for="">City</label><br>
<select class="form-control" name="city" id="">
<?php
while($cr=mysqli_fetch_assoc($city))
{
?>
<option value="<?= $cr['cityid'] ?>" <?php if($cr['cityid'] == $userd['cityid']){ echo "selected"; } ?>><?= $cr['cityname'] ?></option>
<?php } ?>
</select>
</div>
<div class="col-md-5">
<label for="">Interest</label>
<input type="text" name="interest" id="interest" class="form-control" value="<?= $userd['interest'] ?>" required />
</div>
</div>
<div class="row mt-2">
<div class="col-md-10">
<input type="submit" name="uptpd" class="btn-block btn-lg btn btn-custom" value="Update">
</div>
</div>
</div>
</form>
</div>
<div id="aboutme" class="container tab-pane "><br>
<form action="" method="post">
<div class="form-group">
<div class="row">
<div class="col-md-10">
<label for="">About Me</label><br>
<textarea class="tinymce form-control" name="aboutme"><?= $userd['about'] ?></textarea>
<input type="submit" name="upam" class="btn-block btn-lg btn btn-custom mt-2" value="Update">
</div>
</div>
</div>
</form>
</div>
<div id="changepwd" class="container tab-pane "><br>
<form action="" method="post" onsubmit="return userpwd()">
<div class="row">
<div class="col-md-10">
<div class="form-group">
<label for="">Enter Existing Password</label>
<input type="password" name="expassword" id="expassword" class="form-control" required />
</div>
</div>
</div>
<div class="row">
<div class="col-md-10">
<div class="form-group">
<label for="">Enter New Password</label>
<input type="password" name="newpwd" id="newpwd" class="form-control" required />
<span class="text-danger" id="pwderr"></span>
</div>
</div>
</div>
<div class="row">
<div class="col-md-10">
<div class="form-group">
<label for="">Retype New Password</label>
<input type="password" name="repwd" id="repwd" class="form-control" required />
<span class="text-danger" id="repwderr"></span>
</div>
</div>
</div>
<div class="row">
<div class="col-md-10">
<input type="submit" name="uppass" class="btn-block btn-lg btn btn-custom mt-2" value="Change Password">
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="exampleModalLong" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitle" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Upload Profile Picture</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body p-5">
<form method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="file"> Select File</label>
<input type="file" class="form-control" name="dpfile" required>
</div>
</div>
<div class="modal-footer text-left">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" name="btnupdp" class="btn btn-primary">Upload</button>
</form>
</div>
</div>
</div>
</div>
<?php require_once 'footer.php'; ?>
<script>
function userpwd(){
var pwd=document.getElementById('newpwd').value;
var pwdreg= /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[!@#$%^&*()_+])[A-Za-z\d][A-Za-z\d!@#$%^&*()_+]{7,19}$/;
var repwd=document.getElementById('repwd').value;
if(pwd.length >= 6 && pwd.length <= 20)
{
if(pwd.match(pwdreg))
{
if(repwd==pwd)
{
return true;
}else{
document.getElementById("repwderr").innerHTML = "Password Mismatch.";
return false;
}
}else{
document.getElementById("pwderr").innerHTML = "Contain atlest one alpha one number and one special char.";
return false;
}
}else{
document.getElementById("pwderr").innerHTML = "Must Between 6 to 20.";
return false;
}
}
</script>
</body>
</html>