This repository has been archived by the owner on Dec 23, 2018. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
functions.php
68 lines (67 loc) · 1.63 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
<?php
/*
* Function to logout.
*
*/
function logout()
{
setcookie('licapi[username]', '', time() - 3600);
setcookie('licapi[useragent]', '', time() - 3600);
header('Location: login.php');
exit(401);
}
/*
* Function to format Time
*
* @param string $time The date to format
*/
function dateTimeFormat($time)
{
$theDateTime = date('F d, Y g:i a', strtotime($time)); // September 5, 2016 9:14 pm
return $theDateTime;
}
/*
* Function to insert Recent Activity
*
* @param string $type The Activity Type
* @param string $title The Activity Title
*/
function updateActivity($type, $title)
{
global $mysqli;
$activityIp = $_SERVER['REMOTE_ADDR'];
$userAgnt = $_SERVER['HTTP_USER_AGENT'];
$stmt = $mysqli->prepare('
INSERT INTO
activity(
activityType,
activityTitle,
activityDate,
ipAddress,
userAgent
) VALUES (
?,
?,
NOW(),
?,
?
)
');
$stmt->bind_param('ssss',
$type,
$title,
$activityIp,
$userAgnt
);
$stmt->execute();
$stmt->close();
}
/*
* Function to insert HEAD on all PHP pages.
*
* @param string $title The title to set
*/
function head($title)
{
echo '<head><title>'.$title."</title><link rel='stylesheet' type='text/css' href='css/style.css'></head>";
}