-
Notifications
You must be signed in to change notification settings - Fork 0
/
pr_settings.php
61 lines (52 loc) · 2.03 KB
/
pr_settings.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
<div class="container">
<br />
<?php
if(isset($_POST['saved'])==1){
$pwd = mysqli_real_escape_string($dbc, $_POST['pwd']);
$q = "SELECT * FROM users WHERE id='$_SESSION[username]' AND pwd=SHA1('$pwd')";
if(mysqli_num_rows(mysqli_query($dbc, $q))==1){
$name = mysqli_real_escape_string($dbc, $_POST['name']);
$about = mysqli_real_escape_string($dbc, $_POST['about']);
$q = "UPDATE users SET name='$name', about='$about' WHERE id='$_SESSION[username]'";
$r = mysqli_query($dbc, $q);
if($r){
echo "<p class='alert alert-success'>Saved successfully</p>";
}
else{
echo "<p class='alert alert-danger'>Saving failed due to technical error. Please try again...</p>";
}
}
else{
echo "<p class='alert alert-danger'>Incorrect Password</p>";
}
}
$q = "SELECT * FROM users WHERE id='$_SESSION[username]'";
$r = mysqli_fetch_assoc(mysqli_query($dbc, $q));
?>
<form action="" method="post">
<div class="form-group">
<!-- <img src="" alt="avatar"> -->
</div>
<div class="form-group">
<label for="id">UserID : </label>
<input type="text" class="form-control" id="id" name="id" value="<?php echo $r['id']; ?>" disabled>
</div>
<div class="form-group">
<label for="email">Email Address : </label>
<input type="email" class="form-control" id="email" name="email" value="<?php echo $r['email']; ?>" disabled>
</div>
<div class="form-group">
<label for="pwd">Password : </label>
<input type="password" class="form-control" id="pwd" name="pwd" placeholder="Password">
</div>
<div class="form-group">
<label for="name">Name : </label>
<input type="text" class="form-control" id="name" name="name" value="<?php echo $r['name']; ?>" placeholder="Full Name">
</div>
<div class="form-group">
<label for="about">About : </label>
<textarea type="text" class="form-control" id="about" name="about" rows="3"><?php echo $r['about']; ?></textarea>
</div>
<input type="submit" class="btn btn-primary" name="saved" value="Save">
</form>
</div>