forked from halo-battle/game
60 lines
No EOL
2.1 KiB
PHP
60 lines
No EOL
2.1 KiB
PHP
<?php
|
|
|
|
require_once('../../onyx2/load.php');
|
|
|
|
$session = new Session();
|
|
|
|
$message = 'Bienvenue';
|
|
|
|
$login = gpc('login','post');
|
|
$password = gpc('password','post');
|
|
|
|
if($login && $password)
|
|
{
|
|
$file = file('login.list');
|
|
foreach($file as $line)
|
|
{
|
|
$acces = explode(':',$line);
|
|
if($login === $acces[0] && md5($password) == trim($acces[1]))
|
|
{
|
|
$connected = Cache::read('preview_connected');
|
|
|
|
if(!is_array($connected)) Cache::set('preview_connected',array($login => time()));
|
|
|
|
elseif(in_array($login,$connected)) exit(header("Location: preview.php"));
|
|
|
|
else
|
|
{
|
|
$connected[$login] = time();
|
|
Cache::set('preview_connected',$connected);
|
|
}
|
|
|
|
|
|
$session->values = array('login' => $login);
|
|
$session->level = 1;
|
|
$session->put($login);
|
|
|
|
exit(header("Location: preview.php"));
|
|
}
|
|
}
|
|
$message = 'login ou mot de passe incorrect';
|
|
}
|
|
|
|
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
<title>Connexion</title>
|
|
<link rel="stylesheet" href="css/connexion.css" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<form action="" method="post">
|
|
<fieldset>
|
|
<label for="login">Login : <input type="text" id="login" name="login" /></label><br />
|
|
<label for="password">Mot de passe : <input type="password" id="password" name="password" /></label><br />
|
|
<input type="submit" id="submit" value="Connexion" />
|
|
<div><?php echo $message ?></div>
|
|
</fieldset>
|
|
</form>
|
|
</body>
|
|
</html>
|