Karakas Online

18.2.1. How to redirect users to the Login page

If you want your users to be redirected straight to the Login page, rather than the Homepage, do the following:

Right at the begining of the index.php file , add this code after the 'require_once("mainfile.php");' line, like this:

require_once("mainfile.php");
global $user;
if(!is_user($user)) {
  header("Location: modules.php?name=Your_Account");
}

This will send anyone who is not logged in (or registered) to the Your Account (Login) page. See Section 18.6.1 for the inverse procedure - but don't try both. wink

See how to redirect from forms in a PHP-Nuke block for redirection from other places, like blocks.

Last updated Sun Aug 7 21:14:12 CEST 2005 Permalink: http://www.karakas-online.de/EN-Book/redirect-users-to-login-page.html All contents © 2004 Chris Karakas, Claudio Erba