Commit 47125246 authored by Thibault VASSEUR's avatar Thibault VASSEUR
Browse files

Système de connexion fonctionnel

parent ce8fb867
<?php include('config.php'); ?>
<?php include('config.php');
session_start();
session_unset();
session_destroy();?>
<!DOCTYPE html>
<html>
<head>
<?php include('meta.php'); ?>
<title>iPok - Connexion/Inscription</title>
</head>
<head>
<?php include('meta.php');?>
<title>iPok - Connexion</title>
</head>
<body>
<?php include('nav.php'); ?>
<article style="width: 100%">
<div id="connect">
<h1>Connexion</h1><br><br>
<form action="login.php" method="POST">
<label>Pseudonyme </label><br><input type="text" name="login"><br><br>
<label>Mot de passe </label><br><input type="password" name="password"><br><br>
<input type="submit" name="submit" value="Valider">
</form>
</div><!--
--><div id="lignevert">
</div><!--
--><div id="connect">
<h1>Inscription</h1><br><br>
<form action="register.php" method="POST">
<label>Pseudonyme </label><br><input type="text" name="login"><br><br>
<label>Age </label><br><input type="number" name="age"><br><br>
<label>Email </label><br><input type="email" name="email"><br><br>
<label>Mot de passe </label><br><input type="password" name="password"><br><br>
<label>A nouveau mot de passe </label><br><input type="password" name="repeatpassword"><br><br>
<input type="hidden" name="MAX_FILE_SIZE" value="12345" />
<input type="submit" name="submit" value="Valider">
</form>
</div>
<?php include('nav.php');?>
<article style="text-align: center;">
<?php
$db = mysql_connect('localhost', 'thevasseur', 'vincis307');
mysql_select_db('thevasseur',$db);
$db = mysqli_connect('localhost', 'u745198619_ipok', 'droidcara', 'u745198619_ipok');
if (mysqli_connect_errno())
{
printf("Échec de la connexion : %s\n", mysqli_connect_error());
exit();
}
if(isset($_POST) && !empty($_POST['login']) && !empty($_POST['password']))
{
$_POST['password'] = hash("sha1", $_POST['password']);
extract($_POST);
$sql = "select password from membre where login='".$login."'";
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$data = mysql_fetch_assoc($req);
$req = mysqli_query($db, $sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysqli_error());
$data = mysqli_fetch_assoc($req);
if($data['password'] != $password)
{
echo '<br><div class="alert alert-dismissable alert-danger" style="text-align: center;">
echo '<br><div class="alert alert-dismissable alert-danger">
<button type="button" class="close" data-dismiss="alert">x</button>
Mauvais identifiant. Merci de recommencer!
Mauvais identifiant. Merci de recommencer !
</div>';
}
else
{
session_start();
$_SESSION['login'] = $login;
echo '<br><div class="alert alert-dismissable alert-success" style="text-align: center;">
echo '<br><div class="alert alert-dismissable alert-success">
<button type="button" class="close" data-dismiss="alert">×</button>
iPoK, connexion en cours... Redirection dans 3 secondes! <meta http-equiv="refresh" content="3; URL=index.php">
Vous etes bien connecté, Redirection dans 3 secondes ! <meta http-equiv="refresh" content="3; URL=index">
</div>';
}
}
else
{
$champs = '<p><b>Remplissez tous les champs pour vous connectez !</b></p>';
}?>
}
?>
<form action="login" method="POST" class="register">
<p>
Pseudonyme<br>
<input type="text" name="login"><br><br>
Mot de passe<br>
<input type="password" name="password"><br><br>
<input type="submit" name="submit" value="Se connecter">
</p>
</form>
</article>
<?php include('footer.php'); ?>
</body>
</html>
</html>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment