I need to redirect to a page only once - problem more complex than meets the eye

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pvs1
    New Member
    • May 2010
    • 3

    I need to redirect to a page only once - problem more complex than meets the eye

    I've been going around in circles for days on this. I developed over 200 pages of code in a software package and have written the Login scripts in PHP. On about 100 pages are 3 hotlinks in iframe - some which may only be accessed if logged in. If I add php code to the top of the pages to be protected to redirect if not logged in, I get the famous headers already sent error. If I put the same code on a separate page (page1), all is well. There is something in the generated code that is sending headers I think

    The only thing I can think to do is to have a conditional redirect on the calling page to page1 and if logged in return or else then redirect to login page, but obviously need to ensure I do not go into a loop. Any help would be greatly appreciated. I need to go live with this site today.....PLEAS E help
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Can you provide some sample code? I can't visualize your problem.

    Comment

    • pvs1
      New Member
      • May 2010
      • 3

      #3
      Originally posted by Markus
      Can you provide some sample code? I can't visualize your problem.
      Thanks for responding. I have found the problem after 4 days of intense irritation! It was BOM - I needed to set the code not to use charset=utf-8. Thanks awfully for being prepared to assist.

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        I was going to point you to my article on "headers already sent" next, which covers that issue briefly :P

        Anyway, glad you got it sorted.

        Mark.

        Comment

        • pvs1
          New Member
          • May 2010
          • 3

          #5
          Originally posted by Markus
          I was going to point you to my article on "headers already sent" next, which covers that issue briefly :P

          Anyway, glad you got it sorted.

          Mark.
          I think that is where I eventually found the missing link and then saw that the software I was using was using UTF-8. Now I just need to figure out how to escape out of an iframe when redirecting...a ny ideas :)?

          Comment

          Working...