Current version is 4.1.3
- Open the file you wish to protect.
- Include our check class at the top of your file:
<?php include_once('classes/check.class.php'); ?> - 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 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.
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 levels</p>
<?php endif; ?>
<p>The text here can be seen by any user, guest or not!</p>
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.
To call one of these, you could do: <?php echo $_SESSION['jigowatt']['email']; ?>
$_SESSION['jigowatt']['email'] /* Eg: info@jigowatt.co.uk */
$_SESSION['jigowatt']['gravatar'] /* Eg: <img class="gravatar thumbnail" src="http://www.gravatar.com/avatar/acc132?s=26&d=mm&r=g" /> */
$_SESSION['jigowatt']['username'] /* Eg: admin */
$_SESSION['jigowatt']['user_id'] /* Eg: 1 */
$_SESSION['jigowatt']['user_level'] /* Eg: array('Admin', 'Special', 'User'); */
Checks if the user is logged in
<?php
if ( ! session_id() ) {
$minutes = Generic::getOption('default_session');
ini_set('session.cookie_lifetime', 60 * $minutes);
session_start();
}
if(isset($_SESSION['jigowatt']['username'])) {
echo "You're logged in!";
}
?>
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'];
}
?>
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";
}
?>
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.
- Download and install Poedit.
- In Poedit, go to File > New Catalog from POT , and select the
phplogin.potfile, located in/php-login-user-manage/language/.
- Fill out the information on the Project Info tab and press OK
- A prompt will ask you to save the file, save it as
phplogin.poin the following directory:/php-login-user-manage/languages/de_DE/LC_MESSAGES/
We saved it under de_DE for German. Click here for your language's abbreviation. - Start translating! Click on a line and enter your translated text in the huge white box on the bottom of the window.
- Once you're done, just save it and it should automatically generate a
phplogin.mofile. - (Optional) To set German as the default language, open
/php-login-user-manage/classes/translate.class.phpand change en_US to de_DE.