Page 1 of 1

page redirection

Posted: Wed Jul 13, 2005 1:41 pm
by smiley
hi all,
I have been using serendipity blog recently and found it to be a great tool. But I'm stuck with one problem. As soon as I open the website, I want it to be redirected to the login page directly without showing the index page. In brief, This redirection should happen whenever the user is not logged in............I've tried it with some headers and html codes in the index page. I got it to work but don't know why there is some delay before redirection...........How can I avoid that delay???
Please help me solve this !!! :oops:

Re: page redirection

Posted: Wed Jul 13, 2005 2:07 pm
by garvinhicking
In your index.php try this:

After this line:

Code: Select all

header('Content-Type: text/html; charset='. LANG_CHARSET);
add this:

Code: Select all

if (serendipity_userLoggedIn() == false) {
header('Location: ' . $serendipity['baseURL'] . '/serendipity_admin.php');
}
that is the fastest way I know of.

Regards,
Garvin

page redirect

Posted: Wed Jul 13, 2005 3:38 pm
by smiley
hi Garvin,
Thanks a ton for ur instant reply. Your code is fine and we could get the page without delay....but it gave rise to new problem. Our page layout has been changed. There is no template behind and only plain text is being displayed!! what do we do now? :cry:

Re: page redirect

Posted: Wed Jul 13, 2005 5:28 pm
by garvinhicking
Don't know. I'll need your URL to see what you mean. Most probably your CSS is not loaded because it also requires that you're logged in. Maybe you'll need to change the code I told you to not redirect if CSS is requested (see index.php below for the IF-clause that checks if CSS is requested).

Regards,
Garvin

page redirect

Posted: Thu Jul 14, 2005 7:50 am
by smiley
hi Garvin,
Thanku very very much for your valuable help.
My redirection is working very fine now.
:D