/
change_password.php
33 lines (31 loc) · 959 Bytes
/
change_password.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
//session_start();
do_html_header('Changing password');
check_admin_user();
if (!filled_out($_POST))
{
echo 'You have not filled out the form completely.
Please try again.';
do_html_url(baseurl().'cart/admin', 'Back to administration menu');
exit;
}
else
{
$new_passwd = $_POST['new_passwd'];
$new_passwd2 = $_POST['new_passwd2'];
$old_passwd = $_POST['old_passwd'];
if ($new_passwd!=$new_passwd2)
echo 'Passwords entered were not the same. Not changed.';
else if (strlen($new_passwd)>16 || strlen($new_passwd)<6)
echo 'New password must be between 6 and 16 characters. Try again.';
else
{
// attempt update
if (change_password($_SESSION['admin_user'], $old_passwd, $new_passwd))
echo 'Password changed.';
else
echo 'Password could not be changed.';
}
}
do_html_url(baseurl().'cart/admin', 'Back to administration menu');
?>