forked from phpmyadmin/phpmyadmin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLogging.php
43 lines (42 loc) · 1023 Bytes
/
Logging.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
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Logging functionality for webserver.
*
* This includes web server specific code to log some information.
*
* @package PhpMyAdmin
*/
namespace PMA\libraries;
/**
* Misc logging functions
*
* @package PhpMyAdmin
*/
class Logging
{
/**
* Logs user information to webserver logs.
*
* @param string $user user name
* @param string $status status message
*
* @return void
*/
public static function logUser($user, $status = 'ok')
{
if (function_exists('apache_note')) {
apache_note('userID', $user);
apache_note('userStatus', $status);
}
if (function_exists('syslog') && $status != 'ok') {
@openlog('phpMyAdmin', LOG_NDELAY | LOG_PID, LOG_AUTHPRIV);
@syslog(
LOG_WARNING,
'user denied: ' . $user . ' (' . $status . ') from ' .
PMA_getIp()
);
closelog();
}
}
}