This repository has been archived by the owner on Mar 27, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
connexion.php
51 lines (43 loc) · 1.61 KB
/
connexion.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
define('page_titre', "Authentification • Caisse Foyer");
include_once 'inclus/tete.inc.php';
if(!empty($_SESSION['connexion'])
and !empty($_SESSION['t_connexion'])
and $_SESSION['connexion'] == _MDP_ADMIN
and time() - $_SESSION['t_connexion'] < _DELAI_ADMIN){
header('Location: administration.php');
exit();
}
ob_start();
$head_HTML = '<script type="text/javascript" src="scripts/admin.js"></script>';
include_once 'inclus/tete.html.php';
?>
<div class="central bloc caisse">
<a href="./index.php" class="maison">Retour</a>
<h1>Identification</h1>
<?php
if(!empty($_POST['passe'])){
if(sha1($_POST['passe']) == _MDP_ADMIN){
logue("Connexion à l'interface d'administration","connexion","info");
$_SESSION['connexion'] = sha1($_POST['passe']);
$_SESSION['t_connexion'] = time();
ob_end_clean();
header("Location: administration.php?connok=1");
exit();
}
else{
logue("Tentative échouée de connexion à l'interface d'administration par {$_SERVER['REMOTE_ADDR']} [{$_SERVER['HTTP_USER_AGENT']}]","connexion","critique");
?><div class="notif argh estompe"><strong>Échec</strong>C'est refusé mon gars, ce n'est pas le bon mot de passe !</div><?php
}
}
else{
?><div class="notif warn">L'accès à la partie administrative est restreinte, il va falloir entrer un mot de passe !</div><?php
}
?>
<form method="POST" action="connexion.php" class="bloc">
<label for="mdp">Mot de passe</label><input autofocus type="password" name="passe" id="mdp"><br>
<input type="submit" value="C'est parti" class="vert">
</form>
</div>
<?php
include 'inclus/pied.html.php';