/*
* Copyright 2005 Nokia. All rights reserved.
*/
include 'logged_in.php';
include 'database_access.php';
$query ="select * from user where password = OLD_PASSWORD('".$_POST['currentpw']."')";
$result = mysql_query($query);
if (mysql_fetch_array($result))
{
$query = "update user set password = OLD_PASSWORD('".$_POST['pw']."') where id = ".$_SESSION['user_id'];
mysql_query($query);
if (mysql_error())
{
$_SESSION['info_msg'] = "Could not change password: ".mysql_error();
}
else
{
$_SESSION['info_msg'] = "Password changed succesfully.";
}
}
else
{
$_SESSION['info_msg'] = "Current password was incorrect.";
}
header('Location: tasks.php');
?>