Hi I get this error code when I try to run my login script.
Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\Rising sun\css.php:1) in C:\Program Files\Apache Group\Apache2\htdocs\Rising sun\loginmeth.php on line 24
This is the login script stored in loginmeth.php ;
[php]<?php require_once 'config.php';?>
<?php include 'opendb.php';?>
<?php $errorMessage = '';
if (isset($_POST['txtUserId']) && isset($_POST['txtPassword'])) {
$userId = $_POST['txtUserId'];
$password = $_POST['txtPassword'];
$_SESSION['userid'] = $userId;
// check if the user id and password combination exist in database
$sql = "SELECT *
FROM contactd
WHERE email = '$userId' AND password = PASSWORD('$password')";
//WHERE user_id = '$userId' AND user_password = PASSWORD('$password')";
$result = mysql_query($sql)
or die('Query failed. ' . mysql_error());
if (mysql_num_rows($result) == 1) {
// the user id and password match,
// set the session
$_SESSION['db_is_logged_in'] = true;
// after login we move to the main page
header('Location: cart.php');
exit;
} else {
$errorMessage = 'Sorry, wrong user id / password';
}
}
?>[/php]
and all i have in the css.php is
[php] <?php ?>
<style type="text/css">
body { background-color: #000000; font-family: Arial, Helvetica, sans-serif; color: #ffffff }
a:link { color: #ffffff }
a:visited { color: #ffffff }
a:hover { color: #000080 }
a:active { color: #ff6666 }
</style>[/php]
Im guessing that the problem is in the css.php but im not sure why. I check and removed all extra white spaces at the end and beginnning of the <?php ?> tags but it hasn't cured it.
Also what does" header('Location: cart.php'); " Im guessing it sends you to the page specified after you login ?