Added some class="" to pagelist code
[specialops2.git] / passwd.php
blob2641234bb7e771f644f72c437f1927ea39a294e0
1 <?php
2 /**
3 * User Password Editor
5 * @author Anthony Parsons (xmpp:ant@specialops.ath.cx)
6 * @license file://COPYING
7 * @version $Id$
8 */
10 require 'con.php';
11 $page->title = 'Change Password';
13 if ( ! ($user instanceof User_Authenticated) )
14 $page->errorfooter('login');
16 if ( isset($_POST['submit']) ) {
17 try {
18 if ( !$user->check_nullpass() && strval($user->password) != $_POST['old'] ) {
19 throw new InvalidInputException('Old password does not match.');
21 if ( $_POST['new'] != $_POST['n2'] ) {
22 throw new InvalidInputException('New password not confirmed correctly.');
24 if ( !strlen(trim($_POST['new'])) ) {
25 throw new InvalidInputException('New password must not be blank.');
28 $user->password = $_POST['new'];
29 setcookie('p', $_POST['new'], time()+86400, '/');
31 $user->userheader();
32 echo '<p class="notice">Password changed.</p>';
33 } catch ( InvalidInputException $e ) {
34 $user->userheader();
35 echo '<p class="error">',$e->getMessage(),'</p>';
37 } else {
38 $user->userheader();
42 <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
43 <table>
44 <tbody>
45 <tr><th scope="row"><label for="old">Old password</label></th>
46 <td><input type="password" name="old" id="old"<?php
47 echo $user->check_nullpass() ? ' disabled="disabled"' : '' ?>/></td></tr>
48 <tr><th scope="row"><label for="new">New password</label></th>
49 <td><input type="password" name="new" id="new"/></td></tr>
50 <tr><th scope="row"><label for="n2">Retype password</label></th>
51 <td><input type="password" name="n2" id="n2"/></td></tr>
52 </tbody>
53 </table>
55 <p><button type="submit" name="submit" accesskey="c">Confirm (C)</button></p>
56 </form>
58 <?php
59 $page->pagefooter();