Access only to certain levels
  1. Open the file you wish to protect.
  2. Include our check class at the top of your file:
    <?php include_once('classes/check.class.php'); ?>
  3. Call the protect function, also at the top:
    <?php protect("1, 2, 3"); ?>

    With this, your page will only be visible to level 1, 2, and 3 users.

Access to all levels

See profile.php for an example.

Use a wildcard to require signing in before viewing a page.

<?php include_once('classes/check.class.php'); ?>
<?php protect("*"); ?>

This will show your page to all signed in members.

Partial access

See protected.php for an example.

<?php include_once('classes/check.class.php'); ?>
<?php if( protectThis("1, 2, 3") ) : ?>
    <p>This html text is viewable only to levels 1, 2, or 3 </p>
<?php endif; ?>
<p>The text here can be seen by any user, guest or not!</p>
Automatic Installation

Upload all the files to your server, then simply run the Install Wizard.

A link to the wizard can be found on the home.php page, or just open the /install/ folder on your server.

Session data?

To call one of these, you could do: <?php echo $_SESSION['jigowatt']['email']; ?>

$_SESSION['jigowatt']['email']      /* Eg: */
$_SESSION['jigowatt']['gravatar']   /* Eg: <img class="gravatar thumbnail" src="" /> */
$_SESSION['jigowatt']['username']   /* Eg: admin */
$_SESSION['jigowatt']['user_id']    /* Eg: 1 */
$_SESSION['jigowatt']['user_level'] /* Eg: array('1', '2', '3'); */ 
Logged in?

Checks if the user is logged in

if (!isset($_SESSION)) session_start();

if(isset($_SESSION['jigowatt']['username'])) {
    echo "You're logged in!";

Current username

Returns the logged in user's username

if (!isset($_SESSION)) session_start();

if(isset($_SESSION['jigowatt']['username'])) {
    echo "You're username is: " . $_SESSION['jigowatt']['username'];

Is admin?

Checks if the current user is an admin

if (!isset($_SESSION)) session_start();

if(in_array(1, $_SESSION['jigowatt']['user_level'])) {
    echo "You're an admin! Howdy";

Creating translations

In our example, we will create a translation for German (de_DE)

Note: You might have troubles using translations on a Windows environment. It is recommended that you use a Linux server.

  1. Download and install Poedit.
  2. In Poedit, go to File > New Catalog from POT , and select the phplogin.pot file, located in /php-login-user-manage/language/.
  3. Fill out the information on the Project Info tab and press OK
  4. A prompt will ask you to save the file, save it as phplogin.po in the following directory:
    We saved it under de_DE for German. Click here for your language's abbreviation.
  5. Start translating! Click on a line and enter your translated text in the huge white box on the bottom of the window.
  6. Once you're done, just save it and it should automatically generate a file.
  7. (Optional) To set German as the default language, open /php-login-user-manage/classes/translate.class.php and change en_US to de_DE.
Share logins across subdomains?

If you want users to be able to login once and access their login from any subdomain on your website, simply add the following to login.class.php

  1. Open classes/login.php
  2. Find ini_set('session.cookie_lifetime', 60 * $minutes);
  3. Add below ini_set('session.cookie_domain', '');
Manually approve new users?

If you want to moderate all user registrations, you can set their default level to a restricted level. When they sign up, they won't be able to access anything until you move them to a non-restricted level.

  1. Create a new level, call it "Pending". Check the box to disable this level.
  2. Go to Settings > General and set your default level to the Pending level you just created.
  3. Optional: Go to Settings > General and turn off email activation for new users.