2 ob_start(); // This is cheating
6 $page_name = 'Change Password';
7 $level_restriction = NEW_USER
;
9 require 'encryption.inc.php';
11 if (isset ($_POST['submit']))
13 if ( $userinfo['password'] != encrypt($_POST['old_pw'], $userinfo['register_ip']) )
14 echo '<div class="alert">Your current password does not match the one entered.</div>';
15 elseif ( $_POST['new_pw'] != $_POST['confirm_pw'] )
16 echo '<div class="alert">Your new passwords do not match.</div>';
18 mysql_query('UPDATE `users` SET `password` = \''.mysql_real_escape_string(encrypt($_POST['new_pw'], $userinfo['register_ip'])).'\' WHERE
19 `username` = \''.mysql_real_escape_string ($userinfo['username']).'\' AND
20 `password` = \''.mysql_real_escape_string (encrypt ($_POST['old_pw'], $userinfo['regip'])).'\' LIMIT 1');
21 setcookie('password', encrypt ($_POST['new_pw'], $userinfo['regip']), time()+
7776000);
22 stop('Password successfully changed.');
27 <form method="post" action="',$_SERVER['PHP_SELF'],URL_STRING
,'">
28 <dl class=',colour(),'>
29 <dt>Current Password</dt>
30 <dd><input type="password" maxlength="40" size="40" name="old_pw"/></dd>
32 <dd><input type="password" maxlength="40" size="40" name="new_pw"/></dd>
33 <dt>Confirm new password</dt>
34 <dd><input type="password" maxlength="40" size="40" name="confirm_pw"/></dd>
36 <input type="submit" name="submit" value="Change"/>