debugged-ip-logger
------------------------- log.php -------------------------
-------------------------------------------------------------
Code (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
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
<?PHP
error_reporting(E_ALL);
/**********************************************
***************** Configuratie ****************
***********************************************/
$text = 'True';
$rtf = 'False';
$mysql = 'False';
/******************************************************
*********************** String's **********************
*******************************************************/
$ip = $_SERVER['REMOTE_ADDR'];
$pagina = $_SERVER['REQUEST_URI'];
$datum = date("d-m / H:i:s");
$invoegen = $datum . " - " . $ip . " - " . $pagina . "\r\n";
/******************************************************
***************** Hier niks veranderen! ***************
*******************************************************/
if($mysql == 'True') {
echo 'Mysql wordt nog niet ondersteund!';
}
if($text == 'True') {
$fopen = fopen("logfile/access.txt", "a");
fwrite($fopen, $invoegen);
fclose($fopen);
}
if($rtf == 'True') {
$fopen = fopen("logfile/access.rtf", "a");
fwrite($fopen, $invoegen);
fclose($fopen);
}
?>
error_reporting(E_ALL);
/**********************************************
***************** Configuratie ****************
***********************************************/
$text = 'True';
$rtf = 'False';
$mysql = 'False';
/******************************************************
*********************** String's **********************
*******************************************************/
$ip = $_SERVER['REMOTE_ADDR'];
$pagina = $_SERVER['REQUEST_URI'];
$datum = date("d-m / H:i:s");
$invoegen = $datum . " - " . $ip . " - " . $pagina . "\r\n";
/******************************************************
***************** Hier niks veranderen! ***************
*******************************************************/
if($mysql == 'True') {
echo 'Mysql wordt nog niet ondersteund!';
}
if($text == 'True') {
$fopen = fopen("logfile/access.txt", "a");
fwrite($fopen, $invoegen);
fclose($fopen);
}
if($rtf == 'True') {
$fopen = fopen("logfile/access.rtf", "a");
fwrite($fopen, $invoegen);
fclose($fopen);
}
?>
-------------------------- admin/index.php --------------------------
-------------------------------------------------------------------------
<html>
<head>
<title>Administration</title>
</head>
<body>
<p><a href="viewlog.php">View logfile</a><br>
<a href="clearlog.php">Clear logfile</a></p>
</body>
</html>
------------------------- admin/viewlog.php ------------------------
------------------------------------------------------------------------
Code (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
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
<?PHP
error_reporting(E_ALL);
/**********************************************
***************** Configuratie ****************
***********************************************/
$text = 'True';
$rtf = 'False';
$mysql = 'False';
/******************************************************
***************** Hier niks veranderen! ***************
*******************************************************/
if($text == 'True') {
Header("Location: ../logfile/access.txt");
}
if($rtf == 'True') {
Header("Location: ../logfile/access.rtf");
}
if($mysql == 'True') {
echo 'Mysql wordt nog niet ondersteund!';
}
?>
error_reporting(E_ALL);
/**********************************************
***************** Configuratie ****************
***********************************************/
$text = 'True';
$rtf = 'False';
$mysql = 'False';
/******************************************************
***************** Hier niks veranderen! ***************
*******************************************************/
if($text == 'True') {
Header("Location: ../logfile/access.txt");
}
if($rtf == 'True') {
Header("Location: ../logfile/access.rtf");
}
if($mysql == 'True') {
echo 'Mysql wordt nog niet ondersteund!';
}
?>
------------------------- admin/clearlog.php ------------------------
-------------------------------------------------------------------------
Code (php)
-------------------- admin/.htaccess --------------------
------------------------------------------------------------
AuthUserFile .htpasswd
AuthGroupFile /dev/null
AuthName "Administration"
AuthType Basic
<Limit GET POST>
require valid-user
</Limit>
-------------------- admin/.htpasswd --------------------
-------------------------------------------------------------
admin:NIHbb2fO1mXUY
-------------------------- logfile/access.txt --------------------------
-------------------------------------------------------------------------
Gewoon niks!
----- Extra
Dit moet je in elke pagina doen waar je wilt loggen!