Ajout du support des écritures ventilées.
[garradin.git] / www / admin / login.php
1 <?php
2 namespace Garradin;
3
4 const LOGIN_PROCESS = true;
5
6 require_once __DIR__ . '/_inc.php';
7
8 if ($membres->isLogged())
9 {
10 utils::redirect('/admin/');
11 }
12
13 // Relance session_start et renvoie une image de 1px transparente
14 if (isset($_GET['keepSessionAlive']))
15 {
16 $membres->keepSessionAlive();
17
18 header('Cache-Control: no-cache, must-revalidate');
19 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
20
21 header('Content-Type: image/gif');
22 echo base64_decode("R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==");
23
24 exit;
25 }
26
27 $error = false;
28
29 if (utils::post('login'))
30 {
31 if (!utils::CSRF_check('login'))
32 {
33 $error = 'OTHER';
34 }
35 else
36 {
37 if (utils::post('id') && utils::post('passe')
38 && $membres->login(utils::post('id'), utils::post('passe')))
39 {
40 utils::redirect('/admin/');
41 }
42
43 $error = 'LOGIN';
44 }
45 }
46
47 $champs = $config->get('champs_membres');
48
49 $champ = $champs->get($config->get('champ_identifiant'));
50
51 $tpl->assign('champ', $champ);
52 $tpl->assign('error', $error);
53
54 $tpl->display('admin/login.tpl');
55
56 ?>