vendredi 25 juin 2021

Warning: session_start(): Cannot start session when headers already sent in

even if I change the session_start to first-line I am still getting the same error

<?php 
require('dbconnection.php');
session_start();
?>

//posting the values from the form

<?php
$mail = $_POST['mail'];
$pass = $_POST['pass'];
$sql = "SELECT * FROM user WHERE user_email = :mail";
$stmt = $db->prepare($sql);
$stmt->bindValue(':mail', $mail);
$stmt->execute();
$member = $stmt->fetch();

//check the condition and login if success

   if (!empty($member) && $pass == $member['user_pswd'] && $member['user_master'] == 0) {
    $_SESSION['id'] = $member['user_Id'];
    $_SESSION['name'] = $member['user_name'];
    if(isset($_SESSION['id'])){
   
      echo "<script>window.location.href='homepage.php'</script>";
    }

    else{
      $msg = 'ログインしていません';
      $link4 = '<a href="loginform.php">ログイン</a>';
    }
   } else {
       $msg = '<br><div class="row">
}
?>



Aucun commentaire:

Enregistrer un commentaire