I'm getting some error messages on my site:
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/vend/public_html/header.php:1) in /home/buklau/public_html/header.php on line 3
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/vend/public_html/header.php:1) in /home/buklau/public_html/header.php on line 3
Warning: Cannot modify header information - headers already sent by (output started at /home/vend/public_html/header.php:1) in /home/buklau/public_html/includes/user.php on line 36
Here is code header.php
<?php
session_start();
require("./includes/config.inc.php");
require("./includes/user.php");
$starttime = explode(' ', microtime());
$starttime = $starttime[1] + $starttime[0];
$user = new user($db);
//If login attempt else check login session
$checkLogin = $user->valid_login();
//user info var
$user_info = $user->user_info;
?>
<!DOCTYPE html>
and user.php:
<?php
//User info class
class user {
private $db;
public $user_info;
public $login_error;
private $valid = false;
public $user_type = PER_USER;
//Set DB
public function __construct($db=false){
if(!$db){
$db = Database::obtain(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE);
$db->debug = SHOW_SQL_ERROR;
$db->connect();
}
$this->db = $db;
}
//Check valid login and if login in or returning
public function valid_login(){
if(isset($_POST["btnLogin"])) $this->login();
else $this->check_session();
//Unset all session and cookies if not calid
if(!$this->valid) {
foreach($_SESSION as $key => $val) $_SESSION[$key] = '';
foreach($_COOKIE as $key => $val) setcookie($key, '', time()-3600, "");
session_unset();
session_destroy();
}