updated the TOS since some fucktards don't seem to get the first rule
[specialops2.git] / passwd.php
blobb8c424f49d1bbde2f83b8a5b469bcc77d97f3d3c
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->password != $_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.'));
16 if ( !strlen(trim($_POST['new'])) )
17 throw new InvalidInputException(_('New password may not be blank.'));
19 $user->password = $_POST['new'];
20 setcookie('p', $_POST['new'], time()+86400*7);
22 $user->userheader();
23 echo '<div class="notice">',_('Password changed.'),'</div>';
24 } catch ( InvalidInputException $e ) {
25 $user->userheader();
26 echo '<div class="error">',$e->getMessage(),'</div>';
30 $user->userheader();
33 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
34 <table>
35 <tbody>
36 <tr><th scope="row"><label for="old"><?php echo _('Enter old password:'); ?></label></th><td><input type="password" name="old" id="old"/></td></tr>
37 <tr><th scope="row"><label for="new"><?php echo _('Enter new password:'); ?></label></th><td><input type="password" name="new" id="new"/></td></tr>
38 <tr><th scope="row"><label for="n2"><?php echo _('Retype new password:'); ?></label></th><td><input type="password" name="n2" id="n2"/></td></tr>
39 </tbody>
40 </table>
42 <p><button type="submit" name="submit" value="save"><?php echo _('Confirm'); ?></button></p>
43 </form>
45 <?php
46 $page->pagefooter();