Link to home
Start Free TrialLog in
Avatar of Ryan Bayne
Ryan BayneFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Checking login and redirecting to new header from an included part of the page causes header already sent error

Hey

Well the story is my index page calls a header, cell and footer. The cell being the changing element. I'm now adding member only pages and don't know how to protect the page from unauthorised access.

I use this..

<?php
session_start();
if( @$_SESSION['auth'] !="yes")
{header("Location: ../index.php?cellname=pagecells/noauth.php");
exit();
}
?>

and I call it at the start of the cell file that requires protection. Problem is I get errors regarding the header already being sent.

So any ideas on a better way to structure my page. I have offcourse considered sending logged in users to a new php file totally but once again I would want to use cells in that page. If those cell files exist back to square one they will simply be accessed view the original and free to access index.

Only option is whole range of pages created for users only!

thanks for any advice
SOLUTION
Avatar of qaelan
qaelan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ryan Bayne

ASKER

OK lots of good stuff there. Tchuk that seems to be my solution thanks a lot. Never done it before or stored cookies on server but I will see what I can do and more questions if I get stuck

cheers