commit whoring
[specialops2.git] / passwd.php
blobaba1b45550022da7c74fd5aaf9300604e9e76a0c
1 <?php
2 // $Id$
4 require 'con.php';
5 $page->title = _('Change Password');
7 if ( ! ($user instanceof authuser) )
8 $page->errorfooter('login');
10 if ( isset($_POST['submit']) ) {
11 try {
12 if ( $user->u_passwd != $_POST['old'] )
13 throw new InvalidInputException('Old password does not match.');
14 if ( $_POST['new'] != $_POST['n2'] )
15 throw new InvalidInputException('New password not confirmed correctly.');
17 $user->u_passwd = $_POST['new'];
18 setcookie('p', $_POST['new'], time()+86400*7);
20 $user->userheader();
21 echo '<div class="notice">',_('Password changed.'),'</div>';
22 } catch ( InvalidInputException $e ) {
23 $user->userheader();
24 echo '<div class="error">',$e->getMessage(),'</div>';
28 $user->userheader();
31 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
32 <table id="passwd">
33 <tbody>
34 <tr><th scope="row"><label for="old"><?php echo _('Enter old password:'); ?></label></th><td><input type="password" name="old" id="old"/></td></tr>
35 <tr><th scope="row"><label for="new"><?php echo _('Enter new password:'); ?></label></th><td><input type="password" name="new" id="new"/></td></tr>
36 <tr><th scope="row"><label for="n2"><?php echo _('Retype new password:'); ?></label></th><td><input type="password" name="n2" id="n2"/></td></tr>
37 </tbody>
38 </table>
40 <div class="info"><button type="submit" name="submit" value="save"><?php echo _('Confirm'); ?></button></div>
41 </form>
43 <?php
44 $page->pagefooter();