/** get value **/
$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string($_POST['password']);
/** change password **/
if(isset($_POST['task']) && $_POST['task'] == 'changepass')
{
/** get users curret information **/
$user = @mysql_fetch_array(@mysql_query("SELECT * FROM members WHERE id = '".$userid."' LIMIT 1"));
/** get current password **/
$current_pass = $user['password'];
/** get new password **/
$new_pass = $_POST['new_pass'];
/** check if new passwords match **/
if($new_pass != $_POST['new_pass2'])
{
$error = 1;
$error_message = 'New passwords don\'t match.';
}else
/** check old password **/
if($current_pass != sha1($_POST['current_pass']))
{
$error = 1;
$error_message = 'Current password does not match one on file.';
}else
/** check for empty fields **/
if(empty($_POST['current_pass']) || empty($_POST['new_pass']) || empty($_POST['new_pass2']))
{
$error = 1;
$error_message = 'Please fill all required fields.';
}else