Example #1
0
function main()
{
    session_start();
    $views = new Views();
    $models = new Models('localhost', 'hallas', '40352246', 'thehallas');
    $route = new Route($_SERVER['REQUEST_URI']);
    require_once CONTROLLERS . '/' . $route->getParam(1) . '.php';
    $controller = eval('return new ' . $route->getParam(1) . '($views, $models, $route);');
    if (!$route->getParam(2)) {
        $controller->index();
    } else {
        eval('$controller->' . $route->getParam(2) . '();');
    }
    $views->render();
}
Example #2
0
function main()
{
    session_start();
    $views = new Views();
    $models = new Models('localhost', 'fadl', 'vaip', 'fadl');
    $route = new Route($_SERVER['REQUEST_URI']);
    if ($route->getParam(1)) {
        require_once CONTROLLERS . '/' . $route->getParam(1) . '.php';
        $controller = eval('return new ' . $route->getParam(1) . '($views, $models, $route);');
    } else {
        header('location: /Welcome/');
    }
    if (!$route->getParam(2)) {
        $controller->index();
    } else {
        eval('$controller->' . $route->getParam(2) . '();');
    }
    $views->render();
}
Example #3
0
    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;
} elseif ($route->match('join/confirm', 2)) {
    $api->joinConfirm(strip_tags($route->getParam(0)));
    if ($api->getErrors()) {
        Ut::redirectTo(Ut::uri('report'), $api->getErrors());
        exit;
    }
    Ut::redirectTo(Ut::uri('home'), array('Your account was confirmed. Please login'), 'success');
    exit;
} elseif ($route->match('password', null)) {
    //Ut::authRequired();
    $view->view = 'password';
} elseif ($route->match('password/post', 2)) {
    if (!$_POST) {
        Ut::redirectTo(Ut::uri('report'), array('404 Page not found'));
        exit;
    }
    // Prepare and sanitize post input