1 |
<HTML> |
2 |
<HEAD> |
3 |
<TITLE>Stock Monitor: Change password</TITLE> |
4 |
<STYLE type="text/css"> |
5 |
<?php include("stylesheet.css");?> |
6 |
</STYLE> |
7 |
</HEAD> |
8 |
<BODY> |
9 |
<H1><A href="/main.php">stock.andrew.net.au</A> | Change password</H1> |
10 |
<DIV align=right class="toolbar"> |
11 |
<A class="toolbar" href="addwatch.php">Add a watchscreen</A> |
12 |
<A class="toolbar" href="editwatch.php">Edit a watchscreen</A> |
13 |
<A class="toolbar" href="delwatch.php">Delete a watchscreen</A> |
14 |
| |
15 |
<A class="toolbar" href="password.php">Change password</A> |
16 |
</DIV> |
17 |
<?php if (empty($password) || empty($newpass1) || empty($newpass2)) { ?> |
18 |
<FORM method=post> |
19 |
<TABLE> |
20 |
<TR> |
21 |
<TD>Current password</TD><TD><INPUT class="password" type=password name=password size=8 maxlength=16></TD> |
22 |
</TR> |
23 |
<TR> |
24 |
<TD>New password</TD><TD><INPUT class="password" type=password name=newpass1 size=8 maxlength=16></TD> |
25 |
</TR> |
26 |
<TR> |
27 |
<TD>Verify new password</TD><TD><INPUT class="password" name=newpass2 type=password size=8 maxlength=16></TD> |
28 |
</TR> |
29 |
</TABLE> |
30 |
<INPUT type=submit value="Change password"> <INPUT type=reset value="Clear form"> |
31 |
</FORM> |
32 |
<?php } else { ?> |
33 |
<BR> |
34 |
<?php |
35 |
include_once("inc/GetPassword.inc"); |
36 |
include_once("inc/ChangePassword.inc"); |
37 |
if ($newpass1 != $newpass2) { |
38 |
echo "Your new password was not verified"; |
39 |
exit(); |
40 |
} |
41 |
if ($password != getPassword($PHP_AUTH_USER)) { |
42 |
echo "Your current password is incorrect"; |
43 |
exit(); |
44 |
} |
45 |
if (changePassword($PHP_AUTH_USER, $newpass1)) { |
46 |
echo "Your password has been changed"; |
47 |
} else { |
48 |
echo "There was a problem changing your password"; |
49 |
} |
50 |
} ?> |
51 |
</BODY> |
52 |
</HTML> |