Weird issue: code breaking site in IE6

Reply

Join Date: Sep 2008
Posts: 16
Reputation: NRaf is an unknown quantity at this point 
Solved Threads: 0
NRaf NRaf is offline Offline
Newbie Poster

Weird issue: code breaking site in IE6

 
0
  #1
Oct 7th, 2008
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.

  1. <?php
  2. session_start();
  3.  
  4. $loginBar = false;
  5.  
  6. //Check if logged in
  7. if (strcmp($_SESSION['loggedIn'], 'true') != 0)
  8. {
  9. if (!isset($openPage))
  10. {
  11. header('location:loginpage.php');
  12. }
  13. }
  14. else if (strcmp($_SESSION['loginType'], 'admin') == 0)
  15. {
  16. if (!isset($openPage))
  17. {
  18. header('location: admin.php');
  19. }
  20. }
  21. else
  22. {
  23. $username = $_SESSION['user'];
  24. $loginBar = "
  25. <div class=\"loginBar\">
  26. Logged in as student: $username
  27. <a href=\"loginpage.php?action=logout\">Logout</a>
  28. </div>
  29. ";
  30. }
  31. ?>

Any ideas?
Last edited by NRaf; Oct 7th, 2008 at 7:08 am.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,072
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: Weird issue: code breaking site in IE6

 
0
  #2
Oct 7th, 2008
could you please post some more of your code..
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 16
Reputation: NRaf is an unknown quantity at this point 
Solved Threads: 0
NRaf NRaf is offline Offline
Newbie Poster

Re: Weird issue: code breaking site in IE6

 
0
  #3
Oct 7th, 2008
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:
  1. //Needed to work in IE6
  2. ob_start();
  3.  
  4. session_start();
  5.  
  6. header("Cache-control: private");
  7.  
  8. ob_flush();

No idea why it works, so if anyone can explain it, I'd appreciate it.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC