Created: 10/04/2011
By: Arnaud Lemercier
Email: arnaud@wixiweb.fr
Follow me on
Thank you for purchasing my script. If you have any questions that are beyond the scope of this help file, please feel free to email via my user page contact form here. Thanks so much!
Installation is very simple, just copy the file simpleauth.php at the root of your website.
With SimpleAuth, you can secure any web page. To do this you must:
<?php ${(require_once('SimpleAuth.php'))}->protectme(); ?>
Warning, there should be no line breaks or no space before the code
To help you, look at this example:
To configure users, you must open the file SimpleAuth.php
Then, simply edit the list of current users using the same logic
Trying to create a new login "administrator"with a new password and delete the demo accounts
You can now try connecting to your secure page
You can add a link to disconnect the user
For this is very simple, just make a link to the current page with the action "logout"
<a href="?simple_auth_action=logout">Logout</a>
If you want, you can redirect the user after logout
Redirect to the current folder (relative):
<?php ${(require_once('SimpleAuth.php'))}->protectme(array( 'logoutPage' => './' )); ?>
Redirect to the root (absolute) :
<?php ${(require_once('SimpleAuth.php'))}->protectme(array( 'logoutPage' => '/' )); ?>
Redirect to a specifique page (absolute) :
<?php ${(require_once('SimpleAuth.php'))}->protectme(array( 'logoutPage' => '/client/news/' )); ?>
Redirect to an external page (absolute) :
<?php ${(require_once('SimpleAuth.php'))}->protectme(array( 'logoutPage' => 'http://www.wixiweb.fr' )); ?>
You can also edit SimpleAuth.php to configure redirection for All pages :
// Allowed Users List
'allowedUsers' => NULL,
// The page will be displayed after logout
'logoutPage' => 'http://www.wixiweb.fr'
If you are in a secure page, you can display the user login
You can place this line to the place you want it to display the login of the user logged :
<?php echo $simpleAuthInstance->getLogin(); ?>
You can allow access to a page to certain users only. Use the "allowedUsers" option
<?php ${(require_once('SimpleAuth.php'))}->protectme(array( 'allowedUsers' => array('admin', 'client1') )); ?>
You can allow access to a page to certain groups of users only. Use the "allowedGroups" option
<?php ${(require_once('SimpleAuth.php'))}->protectme(array( 'allowedGroups' => array('editor', 'administrator') )); ?>
// Locale for translation
'locale' => 'EN',
// Allow user to change locale
'localeSwitcher' => true,
You can add custom information about your users.
For example, you can add 3 new fieds (phone, email, skype) for 2 users (login@domain.com and admin)
You can retrieve information with the following code :
Phone : <?php echo $simpleAuthInstance->getMetas("phone");?>
Email : <?php echo $simpleAuthInstance->getMetas("email");?>
Arnaud Lemercier