-
Notifications
You must be signed in to change notification settings - Fork 1
/
ucp.php
90 lines (77 loc) · 2.93 KB
/
ucp.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
<?php
include 'system/core/init.php';
if (isset($_SESSION['loggedin'])){
if($_SESSION['loggedin'] = true){
print(load_which("system/templates/header.tpl.php"));
} else {
print(load_which("system/templates/header2.tpl.php"));
}
}
?>
<?php
$username1 = $_SESSION['username'];
if(isset(($_POST['submit']))){
$password1 = ($_POST['newPassword']);
$password2 = ($_POST['confirmPassword']);
if ($password1 <> $password2)
{
echo "<div class='alert alert-danger' role='alert'>Passwords do not match!</div";
}
else if ($password1 == $password2) {
$sql = "UPDATE users SET password='$password1' WHERE username='$username1'";
$res = $conn->query($sql);
if ($res === FALSE) {
echo "<div class='alert alert-danger' role='alert'>Unable to change password</div";
}
else{
echo "<div class='alert alert-success' role='alert'>Password was successfully changed</div>";
}
$conn->close();
}
}
?>
<div class="jumbotron">
<div class="container">
<h1>User Control Panel</h1>
<p>Manage your account settings here <b><?php echo $_SESSION['username'];?></b></p>
</div>
</div>
<div id="exTab2" class="container">
<ul class="nav nav-tabs">
<li class="active">
<a href="#1" data-toggle="tab">Overview</a>
</li>
<li><a href="#2" data-toggle="tab">Change Password</a>
</li>
<li><a href="#3" data-toggle="tab">Change Email</a>
</li>
</ul>
<div class="tab-content ">
<div class="tab-pane active" id="1">
<h3>Username: <b><?php echo $_SESSION['username'];?></b></h3>
</div>
<div class="tab-pane" id="2">
<form name="frmChange" role="form" class="form-signin" method="POST" action="">
<div class="form-group">
<label for="InputPassword2">New Password</label>
<input type="password" class="form-control" id="InputPassword2" placeholder="New Password" name="newPassword">
<label for="InputPassword3">Confirm New Password</label>
<input type="password" class="form-control" id="InputPassword3" placeholder="Confirm Password" name="confirmPassword"> </div>
<button class="btn btn-lrg btn-default btn-block" input type="submit" name="submit">Change it</button>
</div>
<div class="tab-pane" id="3">
<form name="frmChange" role="form" class="form-signin" method="POST" action="">
<div class="form-group">
<label for="InputEmail2">New Email</label>
<input type="email" class="form-control" id="InputEmai;2" placeholder="New Email" name="newEmail">
<label for="InputEmail3">Confirm New Email</label>
<input type="email" class="form-control" id="InputEmail3" placeholder="Confirm Email" name="confirmEmail"> </div>
<button class="btn btn-lrg btn-default btn-block" input type="submit" name="submit">Change it</button>
</div>
</div>
</div>
</div>
</form>
<?php
print(load_which("system/templates/footer.tpl.php"));
?>