-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaccount.php
192 lines (160 loc) · 7.29 KB
/
account.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
<?php
include_once "common/base.php";
if(isset($_SESSION['LoggedIn']) && $_SESSION['LoggedIn']==1):
$pageTitle = "Your Account";
include_once "common/header.php";
include_once 'inc/class.users.php';
$users = new Users($db);
if(isset($_GET['email']) && $_GET['email']=="changed")
{
echo "<div class='alert alert-success' role='alert'>Your email address has been changed.</div>";
}
else if(isset($_GET['email']) && $_GET['email']=="failed")
{
echo "<div class='alert alert-danger' role='alert'>There was an error changing your email address.</div>";
}
if(isset($_GET['password']) && $_GET['password']=="changed")
{
echo "<div class='alert alert-success' role='alert'>Your password has been changed.</div>";
}
elseif(isset($_GET['password']) && $_GET['password']=="nomatch")
{
echo "<div class='alert alert-danger' role='alert'>The two passwords did not match. Try again!</div>";
}
if(isset($_GET['delete']) && $_GET['delete']=="failed")
{
echo "<div class='alert alert-danger' role='alert'>There was an error deleting your account.</div>";
}
list($userID, $v) = $users->retrieveAccountInfo();
?>
<h2>Your Account</h2>
<!-- Change Email-->
<div class="container">
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<form class="form-horizontal" action="db-interaction/users.php" method="POST">
<fieldset>
<div id="legend">
<legend class="">Change Email</legend>
</div>
<div class="control-group">
<div class="controls">
<input type="hidden" name="userid" value="<?php echo $userID ?>" class="form-control input-lg">
</div>
</div>
<div class="control-group">
<div class="controls">
<input type="hidden" name="action" value="changeemail" class="form-control input-lg">
</div>
</div>
<div class="control-group">
<label class="control-label" for="username">Enter New E-mail</label>
<div class="controls">
<input type="email" id="username" name="username" placeholder="" class="form-control input-lg">
<p class="help-block">Change E-mail Address</p>
</div>
</div>
<div class="control-group">
<!-- Button -->
<div class="controls">
<button class="btn btn-success" type="submit" name="change-email-submit"
id="change-email-submit" value="Change Email">Change Email</button>
</div>
</div>
</fieldset>
</form>
</div>
</div>
</div>
<br /><br />
<!-- Change Password-->
<div class="container">
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<form class="form-horizontal" id="change-password-form" action="db-interaction/users.php" method="POST">
<fieldset>
<div id="legend">
<legend class="">Change Password</legend>
</div>
<div class="control-group">
<div class="controls">
<input type="hidden" name="user-id" value="<?php echo $userID ?>" />
</div>
</div>
<div class="control-group">
<div class="controls">
<input type="hidden" name="v" value="<?php echo $v ?>" />
</div>
</div>
<div class="control-group">
<div class="controls">
<input type="hidden" name="action" value="changepassword" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="password">New Password</label>
<div class="controls">
<input type="password" name="p" id="new-password" class="form-control input-lg">
<p class="help-block">Change Password</p>
</div>
</div>
<div class="control-group">
<label class="control-label" for="password">Repeat New Password</label>
<div class="controls">
<input type="password" name="r" id="repeat-new-password" class="form-control input-lg">
<p class="help-block">Repeat password</p>
</div>
</div>
<div class="control-group">
<!-- Button -->
<div class="controls">
<button class="btn btn-success" type="submit" name="change-password-submit"
id="change-password-submit" value="Change Password">Change Password</button>
</div>
</div>
</fieldset>
</form>
</div>
</div>
</div>
<hr />
<!-- Delete Account -->
<div class="container">
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<form class="form-horizontal" action="deleteaccount.php" id="delete-account-form" method="POST">
<fieldset>
<div id="legend">
<legend class="">Delete Your Account</legend>
</div>
<div class="control-group">
<div class="controls">
<input type="hidden" name="user-id" value="<?php echo $userID ?>" class="form-control input-lg">
</div>
</div>
<div class="control-group">
<!-- Button -->
<div class="controls">
<button class="btn btn-danger" type="submit" name="delete-account-submit" id="delete-account-submit"
value="Delete Account?">Delete Account?</button>
</div>
</div>
</fieldset>
</form>
</div>
</div>
</div>
<?php
else:
header("Location: index.php");
exit;
endif;
?>
<div class="clear:both;"></div>
<br><br>
<?php
include_once "common/footer.php";
?>