예제 #1
0
    //    $user = $_SESSION['user'];
    // }
    if (isset($_SESSION['sid'])) {
        $sid = $_SESSION['sid'];
    }
    if (isset($_SESSION['usr'])) {
        $usr = $_SESSION['usr'];
    }
    $app->view()->setData('usr', $usr);
    $app->view()->setData('sid', $sid);
});
/**
* HOME ROUTE
**/
$app->get('/', function () use($app, $dl) {
    $app->render('home.twig', array('code' => $app->getCookie('code'), 'email' => $app->getCookie('email'), 'album' => $app->getCookie('album'), 'subscribe' => $app->getCookie('subscribe'), 'albums' => $dl->get_albums()));
})->name('home');
/**
* HOME ROUTE POST HANDELING
**/
$app->post('/', function () use($app, $dl, $mail) {
    // setup variables from the incoming post
    $album = $app->request->post('album');
    $email = $app->request->post('email');
    $code = strtoupper($app->request->post('code'));
    $subscribe = $app->request->post('mailing_list');
    $address = $app->request->post('address');
    // Set current entries to cookies
    $app->setCookie('code', $code);
    $app->setCookie('email', $email);
    $app->setCookie('album', $album);