I have just moved my site from a self host to a hosted. Before I moved things were working quite well. Now that I have moved things my sessions are not working. After digging I find out that what I used to have shouldn’t of worked but it did. I had my session_start(); in header.php which was an include inside my index.php file. As I said that worked just fine on my server but now that it has been moved i get the
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at index.php:10) in header.php on line 5
I now know that this is because index.php is calling for header.php before session_start is called. I took the sessions out of the header and moved them to the index.php but it only works on the index page. How would i be able to make the sessions work on each page with out having to log in on each page.
Here is what I have right now.
<?php session_start();
if(!$_SESSION['login']){
$_SESSION['rank'];
$_SESSION['loggedinusername'] = $loggedinusername;
$_SESSION['loggedinuseremail'] = $loggedinuseremail;
header("location:login.php");
}
$rank=$_SESSION['rank'];
$loggedinusername=$_SESSION['loggedinusername'];
$loggedinuseremail=$_SESSION['loggedinuseremail'];
?>
Thank you