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.

Setup complete!

Access only to certain levels

See protected_2.php or protected_3.php for an example.

  1. Open the file you wish to protect.
  2. Include our check class at the top of your file:
    <?php include_once('classes/class.check.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 my-account.php for an example.

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

<?php include_once('classes/class.check.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/class.check.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>
Useful functions

Logged in?

Checks if the user is logged in

<?php
if (!isset($_SESSION)) session_start();

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

Current username

Returns the logged in user's username

<?php
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

<?php
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 use German (de_DE)

Note: You will 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 /languages/ of our script.
  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:
    /languages/de_DE/LC_MESSAGES/
    We saved it under de_DE for German. Click here to find your locale (abbreviation).
  5. Start translating!
  6. Once you're done, just save it and it should automatically generate a phplogin.mo file.
  7. Now open /classes/class.translate.php and change en_US to de_DE and English to German.