-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
executable file
·47 lines (34 loc) · 1.12 KB
/
Copy pathfunctions.php
File metadata and controls
executable file
·47 lines (34 loc) · 1.12 KB
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
<?php
/*---- set time zone ----*/
date_default_timezone_set("UTC");
/*---BEGIN login creditials and checking---*/
$host = explode("/",$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);
// always connect to database once
require_once 'data_connect.php';
/************************************************
* *
* has a session started? *
* *
************************************************/
function is_session_started() {
if ( php_sapi_name() !== 'cli' ) {
if ( version_compare(phpversion(), '5.4.0', '>=') ) {
return session_status() === PHP_SESSION_ACTIVE ? TRUE : FALSE;
} else {
return session_id() === '' ? FALSE : TRUE;
}
}
return FALSE;
}
if ( is_session_started() === FALSE ) session_start();
if (empty($_SESSION['login_user'])) {
header('location: /');
}
/************************************************
* *
* creating variables *
* *
************************************************/
$welcome = "Welcome <span id='name'>".$_SESSION['login_name']."</span";
/*---END login creditials and checking---*/
?>