0

Alright I know multiple people have asked this question, but I am having really strange behavior. My code is following and as you can see I did NOT start output before starting the session.

These are always the first lines in my file

<?php
require_once("core/init.php");

//Is user already logged in?
if(remember::isLoggedIn())
{
    header("Location: me");
}

$bg = background::latestBackground();
?>

And this is my init.php

<?php
session_start();

//Include needed files
require_once("functions.php");
require_once("Mobile_Detect.php");

//Detect device type
$detect = new Mobile_Detect;
?>

Thanks in advance

Liam Martens
  • 731
  • 7
  • 22
  • whats there in Mobile_Detect.php and functions.php ? – Vishnu Feb 09 '14 at 15:44
  • 1
    There's definitely some whitespace involved either before the starting tag or the closing tag – asprin Feb 09 '14 at 15:44
  • There is good practice to omit closing PHP tag, if possible. In that case the end of file marks the end of script. So you can avoid the unexpected output. But its hard to say whether it helps you here. – Jiří Chmiel Feb 09 '14 at 15:50
  • It's possible that your file contains BOM characters. Google how to remove them and see if that helps. – casraf Feb 09 '14 at 15:53

1 Answers1

0

So apparently it had to do with the encoding of the file, it was in UTF-8 encoding so I put it back in ANSI. So stupid but thanks!

Liam Martens
  • 731
  • 7
  • 22