I have created a php login form, which works fine using xampp & phpmyadmin,
but when I upload it to my server, I can register a user but get the following error when trying to log in.
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /php/index.php:9) in /php/login.php on line 24
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /php/index.php:9) in /php/login.php on line 24
Warning: Cannot modify header information - headers already sent by (output started at /php/index.php:9) in /php/login.php on line 28
i have php included the login form on the index.php page
the login.php code is...
<?php include("dbconnect.php"); ?>
<?php
if(isset($_POST["submit1"])){
if(!empty($_POST['user']) && !empty($_POST['pass'])) {
$user=$_POST['user'];
$pass=$_POST['pass'];
$query=mysql_query("SELECT * FROM login WHERE username='".$user."' AND password='".$pass."'");
$numrows=mysql_num_rows($query);
if($numrows!=0)
{
while($row=mysql_fetch_assoc($query))
{
$dbusername=$row['username'];
$dbpassword=$row['password'];
}
if($user == $dbusername && $pass == $dbpassword)
{
session_start();
$_SESSION['sess_user']=$user;
/* Redirect browser */
header("Location: member.php");
}
} else {
echo "Invalid username or password!";
}
} else {
echo "All fields are required!";
}
}
?>
Thank you