It might be an issue with my laptop's IE6 although I haven't ascertained this.

Anyway, I'm having a really weird issue. When I open my website in IE6 and click on a link inside that page, the page doesn't load for some reason. I just get the background color and if I try and link on View Source nothing comes up. However if I refresh the page, the page is shown as expected.

I'm totally stumped as to why this happens although I've been able to narrow it down to the following script which is being run at the top of my pages:

EDIT: I've figured out session_start() is causing the issue. Commenting it out fixes the problem. Now I want to know why this happens and how on earth I can work around it.

<?php
   session_start();
   
   $loginBar = false;
   
   //Check if logged in
   if (strcmp($_SESSION['loggedIn'], 'true') != 0)
   {
      if (!isset($openPage))
      {   
         header('location:loginpage.php');
      }
   }
   else if (strcmp($_SESSION['loginType'], 'admin') == 0)
   {
      if (!isset($openPage))
      {   
         header('location: admin.php');
      }
   }
   else
   {
      $username = $_SESSION['user'];
      $loginBar =  "
      <div class=\"loginBar\">
         Logged in as student: $username
         <a href=\"loginpage.php?action=logout\">Logout</a>
      </div>
      ";
   }
?>

Any ideas?

could you please post some more of your code..

I figured it out through a fix on the internet. It was the session_start() that was causing the issue but replacing it with the following code block seemed to have fixed the issue:

//Needed to work in IE6
   ob_start();
   
   session_start();
   
   header("Cache-control: private");
   
   ob_flush();

No idea why it works, so if anyone can explain it, I'd appreciate it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.