Irksome Posted July 19, 2007 Share Posted July 19, 2007 Hi all, I'm in the process of making a website with a login and admin section, but I've gotten stuck at permissions for it. I have it set up so it detects your user level, and if you aren't admin user level, it exits the script. This works fine, but when it exits the script, it cuts off the rest of my website layout as well. So I'm left with half a site. My question is: if I exit a script, is there a piece of code I can use to bring back the rest of the site? Hope that makes sense. Quote Link to comment Share on other sites More sharing options...
chigley Posted July 19, 2007 Share Posted July 19, 2007 I tend to use something like: <?php include("footer.php"); die(); ?> Where footer.php boxes off your layout nicely Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 19, 2007 Share Posted July 19, 2007 you can try something like <?php //top of doc if(!logged in){ exit(include("login.php"); } ?> that will get you what you are looking for just make sure login.php has the full template on it. Quote Link to comment Share on other sites More sharing options...
Caesar Posted July 19, 2007 Share Posted July 19, 2007 Why not make it simple and redirect them?...or even display the content only if they are a certain user level? <?php echo' <html> <head> <title>Blah blah blah</title> </head> <body>'; if($_SESSION['admin'] == 1) { //Load admin content } echo' </body> </html>'; ?> Quote Link to comment Share on other sites More sharing options...
Irksome Posted July 19, 2007 Author Share Posted July 19, 2007 Hi, thanks for the quick replies. Got it sorted now thanks to Caesar's solution, thanks again! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.