30 lines
650 B
PHP
30 lines
650 B
PHP
<?php
|
|
|
|
session_start();
|
|
|
|
try{
|
|
$bdd = new PDO('mysql:host=mysql.hostinger.fr;dbname=u808188674_bcom;charset=utf8', 'u808188674_bcom', '*******************');
|
|
}catch(Exception $e){
|
|
die ('Erreur : ' . $e->getMessage());
|
|
}
|
|
|
|
$req=$bdd->prepare('SELECT * FROM users WHERE pseudo=?');
|
|
$req->execute(array($_POST['pseudo']));
|
|
$reponce=$req->fetch();
|
|
|
|
if($reponce != null){
|
|
if($reponce['mdp']===$_POST['mdp']){
|
|
$_SESSION['session_id'] = $reponce['ID'];
|
|
$_SESSION['session_mdp'] = $reponce['mdp'];
|
|
header('Location:index.php?i=0');
|
|
}else{
|
|
header('Location:login.php?i=2');
|
|
}
|
|
}else{
|
|
header('Location:login.php?i=1');
|
|
}
|
|
|
|
|
|
$req->closeCursor();
|
|
?>
|