Why the code is producing the error "Requested URL not found on this server"

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="bootstrap-4.0.0-dist/js/bootstrap.bundle.min.js"></script>
    <title>Document</title>
</head>
<body>
<?php
include("configure2.php");
session_start();
if(isset($_SESSION["username"])) {
    $username = $_SESSION["username"];
} else {
    echo "You are not logged in.";
    header("location:signin.php");
}
if(isset($_POST["signin"]))
{
    $login=$_POST["mail"];
    $pas=$_POST["passwd"];
    $query="select * from signup where Gmail='$login';";
    $res=mysqli_query($con,$query);
    $numRows=mysqli_num_rows($res);
    if($numRows==1)
    {
        $row=mysqli_fetch_assoc($res);
        if(password_verify($pas,$row['Psswd']))
        {
            $_SESSION["login_sess"]="1";
            $_SESSION["login_mail"]=$row['Gmail'];
            header("location:main.html");
        }
        else
        {
            header("location:signin.php?loginerror=".$login);
        }
    }
    else
    {
        header("location:signin.php?loginerror=".$login);
    }
}
error_reporting(E_ALL);
?>
    
</body>
</html>

producing the error…how? when?

Also you cant send header after any part of the HTML. So you’ve gotta do the PHP bit first.

Thanks for the reply,it’s ok now😌

Care to share with the rest of the class what went wrong, so anyone who comes later with a similar problem has something they can check?

Well,it was a problem with the file name I’ve given in side(header)

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.