Hi Antonio would you be able to tell me what I am doing wrong in my script that generates these errors:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home1/potberry/database/link_db.php:2) in /home1/potberry/public_html/ewe/login.php on line 17
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home1/potberry/database/link_db.php:2) in /home1/potberry/public_html/ewe/login.php on line 17
Warning: Cannot modify header information - headers already sent by (output started at /home1/potberry/database/link_db.php:2) in /home1/potberry/public_html/ewe/login_functions.inc.php on line 22
<?php # Script 12.12 - login.php #4
// This page processes the login form submission.
// The script now stores the HTTP_USER_AGENT value for added security.
// Check if the form has been submitted:
ini_set('display_errors', 1);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Need two helper files:
require ('login_functions.inc.php');
require ('../../database/link_db.php');
// Check the login:
list ($check, $data) = check_login($dbc, $_POST['emailaddress'], $_POST['password']);
if ($check) {
session_start();
$_SESSION['customer_id'] = $data['customer_id'];
$_SESSION['firstname'] = $data['firstname'];
// Store the HTTP_USER_AGENT:
$_SESSION['agent'] = md5($_SERVER['HTTP_USER_AGENT']);
// Redirect:
redirect_user('loggedin.php');
} else { // Unsuccessful!
// Assign $data to $errors for login_page.inc.php:
$errors = $data;
}
mysqli_close($dbc); // Close the database connection.
} // End of the main submit conditional.
// Create the page:
include ('login_page.inc.php');
?>