Database error: SQLSTATE[HY000] [1045] Access denied for user 'u104429_jigowatt'@'' (using password: YES)

Current version is 4.1.4

Access only to certain roles
  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("Admin, Special, User"); ?>

    With this, your page will only be visible to users that belong to those roles.

Access to all roles

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("Admin, Special, User") ) : ?>
    <p>This html text is viewable only to these named roles</p>
<?php endif; ?>
<p>The text here can be seen by any user, guest or not!</p>
Automatic Installation
  • Create a database for your application on your hosting platform (noting it's login details)
  • Upload the files inside the 'php-login-user-management' folder 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('Admin', 'Special', 'User'); */ 
Logged in?

Checks if the user is logged in

if ( ! session_id() ) {
	$minutes = Generic::getOption('default_session');
	ini_set('session.cookie_lifetime', 60 * $minutes);

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 role to a restricted role. When they sign up, they won't be able to access anything until you move them to a non-restricted role.

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