function check_password()
{
$pass = $this->data['password'];
if (SES_ID) {
$userinfo = $this->User->find('first', array('conditions' => array('User.id' => SES_ID)));
if ($userinfo['User']['password']) {
if ($userinfo['User']['password'] == md5($pass)) {
echo 1;
exit;
} else {
echo "Wrong password entered.";
exit;
}
} else {
if ($userinfo['User']['password'] == '' && $pass == '') {
echo 1;
exit;
}
}
} else {
echo "You are not allowed to do this activity";
exit;
}
}