debugged-ip-logger

Gesponsorde koppelingen

PHP script bestanden

  1. debugged-ip-logger

« Lees de omschrijving en reacties

------------------------- log.php -------------------------
-------------------------------------------------------------

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
<?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);
}

?>


-------------------------- 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)
PHP script in nieuw venster Selecteer het PHP script
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
<?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!';
}

?>


------------------------- admin/clearlog.php ------------------------
-------------------------------------------------------------------------

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
<?php

$clear
= ""; // Empty string

$fp = fopen("../logfile/access.txt", "w") or die("Error, Cannot create logfile!"); // Open the logfile

fwrite($fp, $clear); // Write to the logfile
fclose($fp); // Close the logfile

echo "The logfile has been cleared!"; // Show a message

?>


-------------------- 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!

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
<?PHP
include ('log.php');
?>

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.