I get "Cannot modify header information" error with this code.
This is my login.php:
<?php include("connection.php"); ?>
<?php
if(isset($_SESSION["session_username"])){
header("Location: intropage.php");
}
if(isset($_POST["login"])){
sometimes i get "please enter login and password" all the time.
if(!empty($_POST['username']) && !empty($_POST['password'])) {
$username=$_POST['username'];
$password=$_POST['password'];
$query =mysql_query("SELECT * FROM users WHERE password='".$password."'");
$numrows=mysql_num_rows($query);
if($numrows!=0) {
while($row = mysql_fetch_assoc($query)) {
$dbusername = $row["username"];
$dbpassword = $row["password"];
}
if($username == $dbusername && $password == $dbpassword) {
$_SESSION["session_username"] = $username;
header("Location: intropage.php");
}else{
echo "Incorrect login or password";
}
}else{
echo "Please enter login and password";
}
}
}
?>
<?php include("header.php"); ?>