Scenario: I’m building a site in EE where all pages are viewable only after a user logs in. After logging in, api key and other variables are maintained in php session variables. So, if a user enters a URL directly, I need to check to see if they’ve already logged in and if the session exists.
I’ve tried putting a simple php script at the beginning of a EE template but I guess it won’t work properly because the page is rendered and then loaded?
Here’s what I’m currently trying…
<?php
if(true){
// not logged in
header('Location: http://...login address…');
} else {
// logged in already, continue
}
?>
.
.
rest of EE template
.
.I could use a javascript redirect, but that would be after the page is loaded and all. Any thoughts?
Forgive me if I didn’t post this in the right category.