Ejemplo n.º 1
0
}
if (isset($_POST['password'])) {
    $Error = new error();
    $s = true;
    if (isset($_POST['password']) && empty($_POST['password'])) {
        $Error->set('password', $tpl->assign('error_password_empty', 'true'));
        $tpl->assign('error', 'true');
        $s = false;
    } elseif (strlen($_POST['password']) <= 5) {
        $Error->set('password', $tpl->assign('error_strlen', 'true'));
    }
    if (isset($_POST['retypedPassword']) && empty($_POST['retypedPassword'])) {
        $Error->set('retypedPassword', $tpl->assign('error_empty_retypedPassword', 'true'));
        $tpl->assign('error', 'true');
        $s = false;
    }
    if (isset($_POST['password']) && isset($_POST['retypedPassword']) && $s == true) {
        if (trim($_POST['password']) != trim($_POST['retypedPassword'])) {
            $Error->set('passwordNot', $tpl->assign('error_password_not_egal', 'true'));
            $tpl->assign('error', 'true');
        }
    }
    if (!$Error->ErrorPresent()) {
        $password = hashMe($_POST['password']);
        $req = $db->query('UPDATE users SET password="******" WHERE id="' . safe($data['uid'], 'HTML') . '"');
        $db->query('DELETE FROM habbophp_password_forgotten WHERE id="' . safe($data['id'], 'HTML') . '"');
        redirection($config->url_site . '/');
    }
}
$tpl->assign('email', $data['mail']);
$tpl->display('password_forgotten.tpl');