Example #1
0
});
$app->get('/dashboard', function () use($app) {
    unset($_SESSION['pcount']);
    $_SESSION['pcount'] = Project::countProjects();
    $new_user = new User("", "");
    $user = $new_user->authenticate($_SESSION['gemail']);
    return $app['twig']->render('dashboard.html.twig', array('user' => $user, 'project_number' => $_SESSION['pcount']));
});
$app->post("/dashboard", function () use($app) {
    unset($_SESSION['gemail']);
    $_SESSION['gemail'] = $_POST['email'];
    $password = $_POST['password'];
    $new_user = new User("", preg_quote($_POST['email'], "'"), preg_quote($_POST['password'], "'"));
    $user = $new_user->authenticate($_SESSION['gemail']);
    if ($user != null) {
        $_SESSION['pcount'] = Project::countProjects();
        return $app['twig']->render('dashboard.html.twig', array('user' => $user, 'project_number' => $_SESSION['pcount']));
    } else {
        return $app['twig']->render('error.html.twig');
    }
});
// Include Other Routes
require_once __DIR__ . "/../routes/coach_new_project.php";
require_once __DIR__ . "/../routes/coach_active_project.php";
require_once __DIR__ . "/../routes/coach_new_habit.php";
require_once __DIR__ . "/../routes/coach_active_habit.php";
require_once __DIR__ . "/../routes/habit.php";
require_once __DIR__ . "/../routes/journal.php";
require_once __DIR__ . "/../routes/project.php";
require_once __DIR__ . "/../routes/user.php";
return $app;