lychee/php/modules/session.php
Tobias Reich dd2f6ebc77 V2.0
- All new redefined interface
- Faster animations and transitions
- Import from Dropbox
- Import from Server
- Download public albums
- Several sorting options
- Installation assistent
- Infobox and description for albums
- Faster loading and improved performance
- Better file handling and upload
- Album covers are chosen intelligent
- Prettier URLs
- Massive changes under the hood
- IPTC support (Headline and Caption)
- EXIF Orientation support

How to update:
1. Replace all files, excluding `uploads/`
2. Open Lychee and enter your database details
2014-01-22 11:12:51 +01:00

64 lines
1.2 KiB
PHP
Executable File

<?php
/**
* @name Session Module
* @author Philipp Maurer
* @author Tobias Reich
* @copyright 2014 by Philipp Maurer, Tobias Reich
*/
if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
function init($mode) {
global $settings;
$return['config'] = $settings;
unset($return['config']['password']);
// No login
if ($settings['username']===''&&$settings['password']==='') $return['config']['login'] = false;
else $return['config']['login'] = true;
if ($mode==='admin') {
$return['loggedIn'] = true;
} else {
unset($return['config']['username']);
unset($return['config']['thumbQuality']);
unset($return['config']['sorting']);
unset($return['config']['login']);
$return['loggedIn'] = false;
}
return $return;
}
function login($username, $password) {
global $database, $settings;
// Check login
if ($username===$settings['username']&&$password===$settings['password']) {
$_SESSION['login'] = true;
return true;
}
// No login
if ($settings['username']===''&&$settings['password']==='') {
$_SESSION['login'] = true;
return true;
}
return false;
}
function logout() {
session_destroy();
return true;
}
?>