File src/www/admin/login.php artifact 2e1cd5e3ac part of check-in 5112ee854a


<?php
namespace Garradin;

define('GARRADIN_LOGIN_PROCESS', true);
require_once __DIR__ . '/_inc.php';

// Relance session_start et renvoie une image de 1px transparente
if (isset($_GET['keepSessionAlive']))
{
    $membres->keepSessionAlive();

    header('Cache-Control: no-cache, must-revalidate');
    header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');

    header('Content-Type: image/gif');
    echo base64_decode("R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==");

    exit;
}

$error = false;

if (!empty($_POST['login']))
{
    if (!utils::CSRF_check('login'))
    {
        $error = 'OTHER';
    }
    else
    {
        if (!empty($_POST['email']) && !empty($_POST['passe'])
            && $membres->login($_POST['email'], $_POST['passe']))
        {
            utils::redirect('/admin/');
        }

        $error = 'LOGIN';
    }
}

$tpl->assign('error', $error);

$tpl->display('admin/login.tpl');

?>