How to redirect users to the Login page

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: account.html");
}

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.

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

 

Site Info v2.2.2

Last SeenLast Seen
Server TrafficServer Traffic
  • Total: 338,957,276
  • Today: 55,194
Server InfoServer Info
  • Oct 18, 2017
  • 06:56 pm PDT
 
 

Daily Inspiration