Exemplo n.º 1
0
    }
    // User not found
    Ut::redirectTo(Ut::uri('user'));
    exit;
} elseif ($route->match('join', null)) {
    $view->view = 'join';
} elseif ($route->match('join/post', 2)) {
    // Check post
    if (!$_POST) {
        Ut::redirectTo(Ut::uri('report'), array('404 Page not found'));
    }
    // Prepare and sanitize post input
    $api->setInputs($_POST);
    // Validation
    if (!Ut::isEmail($api->getInputVal('mail'))) {
        $api->setErrors('Invalid email address');
    }
    if (!Ut::strLenght($api->getInputVal('pw'), 6)) {
        $api->setErrors('Password must be min 6 characters length');
    }
    if ($api->getErrors()) {
        Ut::redirectWithValidation(Ut::uri('join'), $api->getErrors(), $api->getInputs());
        exit;
    }
    $api->join();
    if ($api->getErrors()) {
        Ut::redirectWithValidation(Ut::uri('join'), $api->getErrors(), $api->getInputs());
        exit;
    }
    Ut::redirectTo(Ut::uri('report'), array('Your account was created. Please check your email and confirm the registration'), 'success');
    exit;