Yes I know this has already been done, but this problem is different.
The error I get is:
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/u5558315/public_html/admin/index.php:1) in /home/u5558315/public_html/admin/includes/php/header.php on line 3
I've looked if there is white space in front and behind the PHP start tag, end tag and anything before the actual session_start()
.
session_start();
is the first thing on the PHP script after the actual <?php
tag. I've also tried ob_start()
but also fails to fix the error.
header.php
<?php
ob_start();
session_start();
include('includes/php/functions.php');
if (!isset($_SESSION['login'])) {
redirect('login.php');
}
$now = time(); // checking the time now when home page starts
if($now > $_SESSION['expire']){
echo '<script type="javascript">
alert("Your Session Has Timedout");
</script>';
session_destroy();
}
ob_end_flush();
?>
index.php
<?php
include('includes/php/header.php');
?>
All things suggested by other StackOverflow questions have failed to work. Is there anything else that I could do to fix the issue?
Regards, Tim Vos
What does the redirect function do?
Error shows something on line 5. So its something with redirect function.
I think this should solve your problem.
if (!isset($_SESSION['login'])) {
header('location:login.php');
exit;
}
I honestly don't know how I fixed it or even if I fixed it, but it works.
The host might of changed something in the config to fix it, but I honestly don't know.
Thanks for the answers