Pro Login User Management System Documentation

Login Protect Pages


If you have some website pages outside of the system, you can include a small script into your file to make it so that users must be logged in to view it. Here's a detailed guide on how to do it.

1) Identify what files you want to be login protected. The files need to be PHP files, so if you have any HTML files you'll need to rename them with .php extensions. For example, about-us.html becomes about-us.php. The reason is so that the login protect script can check for a logged in user. It cannot do this on a regular HTML page.

2) Once you have the file, you'll need to locate two files in your download file. Open up zip/extra/login_checker/ and you should see two files: index_check.php and login_checker.php.

3) You need to place index_check.php inside the root directory of your system (where the application, system and images folders are).

4) Next you need to open up your file that you want to protect and insert the code from login_checker.php into the top of the file. For example:


 

My page

Hello welcome to my page!

Becomes:


    /* Login Checker Script */

    /*

        This script can be used in your other files to check to make sure a user

        is logged in.

 

        You just need to make sure that the file you add this script to is a
        PHP file. If you have a HTML file, you can simply rename it with the
        .php extension.

        If you include this file from another directory, you'll need to uncomment
        the $system_path and $application_folder lines.

    */

     ob_start();
     define("REQUEST", "external");

     /* Directory paths
        Only change these if your files are outside the original directory
        of the application. Use  for each folder you are out by.

        By default, it uses the original CodeIgniter values.
     */
    // $system_path = "prologin/system";
    // $application_folder = "prologin/application";

    include('prologin/index_check.php');
    ob_end_clean();
    $CI =& get_instance();

    if(!$CI->user->loggedin) {
        redirect(site_url("login"));
    }
?>

My pageHello welcome to my page!

If your external file is outside of the system directory, you'll need to un-comment two variables in the php code:

  $system_path = "prologin/system";
  $application_folder = "prologin/application";

And rename prologin to the folder in which the software is in.

Save the file and now whenever a user visits your page, the user will be automatically redirected to the login page if they are not already logged in. This allows you to protect many areas of your site and give access to your members.

Remember, if you need help setting this up, feel free to send in a Support Request!