j ai un soucis avec fichier de connexion
après que l utilisateur a rentre ces instructions de connexion
j ai cette erreur
Notice: Undefined index: id in /storage/ssd3/226/15539226/public_html/nosignal/connexion.php on line 17
Warning: Cannot modify header information - headers already sent by (output started at /storage/ssd3/226/15539226/public_html/nosignal/connexion.php:17) in /storage/ssd3/226/15539226/public_html/nosignal/connexion.php on line 19
j ai beau vérifier le fichier de connexion tout me semble bon pourtant
Code : Tout sélectionner
<?php
session_start();
// require_once 'config.php';
require_once 'config.php';
if(!empty($_POST['pseudo']) && !empty($_POST['password']))
{
$pseudo = htmlspecialchars($_POST['pseudo']);
$password = htmlspecialchars($_POST['password']);
$check = $bdd->prepare('SELECT pseudo, password FROM utilisateurs WHERE pseudo = ?');
$check->execute(array($pseudo));
$data = $check->fetch();
$row = $check->rowCount();
if($row == 1)
{
if(password_verify($password, $data['password']))
{
$_SESSION['user'] = array('id'=>$data['id'],'pseudo'=>$data['pseudo']) ;
$_SESSION['pseudo'] = $data['pseudo'];
header('Location:accueil-peche-perle.php?pseudo='.$_SESSION['pseudo']);
die();
}else{ header('Location:index.php?login_err=password'); die(); }
}else{ header('Location: index.php?login_err=already'); die(); }
}
?>