-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
71 lines (60 loc) · 1.45 KB
/
functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/*-------------------------------------------------------+
| Login PHP MYSQL
| https://github.com/elyonox/login-php-mysql
+--------------------------------------------------------+
| Author: Ionut Manole (Yonox)
| Email: [email protected]
| Author URL: https://github.com/elyonox
+--------------------------------------------------------+*/
if ( ! defined( 'LPMPATH' ) ) {
exit(); // Exit if accessed directly.
}
/**
* Verify if user is logged in.
*/
function userLoggedIn()
{
$lpmUserLoggedIn = false;
if ( isset( $_SESSION['lpmlogged'] ) && $_SESSION['lpmlogged'] === true &&
isset( $_SESSION['id_session'] ) && !empty( $_SESSION['id_session'] ) &&
isset( $_SESSION['username'] ) && !empty( $_SESSION['username'] ) )
{
$lpmUserLoggedIn = true;
}
return $lpmUserLoggedIn;
}
/**
* Load pages.
*/
function lpm_pages()
{
$req_page = isset($_GET['page']) ? $_GET['page'] : 'home';
$page_path = getcwd() . DIRECTORY_SEPARATOR .'pages'. DIRECTORY_SEPARATOR . rtrim($req_page,"/") .'.php';
if ( ! file_exists( $page_path ) )
{
$page_path = getcwd() . DIRECTORY_SEPARATOR .'pages'. DIRECTORY_SEPARATOR .'404.php';
}
include $page_path;
}
/**
* Load page header.
*/
function lpm_header()
{
include( LPMTMPL .'header.php' );
}
/**
* Load page footer.
*/
function lpm_footer()
{
include( LPMTMPL .'footer.php' );
}
/**
* Load site template.
*/
function load_lpmTemplate()
{
require_once( LPMTMPL .'template.php' );
}