-2

I have a question. When I want to log in to my website, I get a really weird error, "Warning: Cannot modify header information - headers already sent by (output started at script:29) in script on line 44"

<?php
$verhalten = 0;
include("connect.php");

if(!isset($_SESSION["email"]) and !isset($_GET["page"]))  {
$verhalten = 0;
}
if (isset($_GET["page"]) && ($_GET["page"]) == "log") {

$user = $_POST["user"];
$passwort = md5($_POST["passwort"]);
}
?>


if($email == $row->Email && $pass_hash == $row->Passwort)
    {

        header("Location: such_form_kunden.php?ID=$row->Kundennr");
        $_SESSION["email"] = $email;
        $verhalten = 1;
        exit;
    }
Yung-LX
  • 25
  • 3

1 Answers1

0

Try Doing this maybe this will work.

if (headers_sent()) {
    die("Redirect failed. Please click on this link: <a href=...>");
}
else{
    exit(header("Location: /user.php"));
}
Bits Please
  • 877
  • 6
  • 23