0

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home2/username/public_html/domain/themes/admin/includes/header.php:9) in /home2/username/public_html/domain/themes/admin/includes/header.php on line 10

Code for header.php

<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,400,600italic,600' rel='stylesheet' type='text/css'>

    <?php
        if (!isset($_SESSION)) session_start();
        if (!isset($_SESSION['admin_eap_secure'])) 
        {
            header('Location: ./index.php');
        }
        include "../config/config.php";
        include "../includes/functions.php";
    ?>

1 Answers1

2

This code if (!isset($_SESSION)) session_start(); have to be before any HTML or any echo.

Oh, sorry, session code + header should be before. Like this:

    <?php
        if (!isset($_SESSION)) session_start();
        if (!isset($_SESSION['admin_eap_secure'])) 
        {
            header('Location: ./index.php');
        }
        include "../config/config.php";
        include "../includes/functions.php";
    ?>
    <!DOCTYPE html>
    <html lang="en">
        <head>
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
            <link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300' rel='stylesheet' type='text/css'>
            <link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,400,600italic,600' rel='stylesheet' type='text/css'>