2banornot2ban

Gesponsorde koppelingen

PHP script bestanden

  1. 2banornot2ban

« Lees de omschrijving en reacties

index.php

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
<?php
$var_2banornot2ban_validation
= 1;
include('data/script.php');
?>


data/script.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
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php

// VALIDATION
// A little security pre-caution
// This will prevent people from directly accessing pages that should be included
// If direct access would be granted, the page would be full of errors

if ((!isset($var_2banornot2ban_validation)) or ($var_2banornot2ban_validation !== 1))
    {

    die('Direct access to this page is not allowed...');
    }


/* ---------- BEGINNING OF THE GLOBAL CONFIGURATION ---------- */

// This is where we will set up the script

// SCRIPT FUNCTION
// The first function defines whether we are using a whitelist or a blacklist
// 1) Whitelist: Only the IP's in the list may pass
// 2) Blacklist: The IP's in the list may not pass

$var_2banornot2ban_function = 2;
// Default: $var_2banornot2ban_function = 2;

// ADMINISTRATOR E-MAIL
// Please fill in the admin's e-mail address below

$var_2banornot2ban_admin = '[email protected]';
// Default: $var_2banornot2ban_admin = '[email protected]';

// DATA FOLDER
// The next variable contains the path to the 'data' folder of this script
// You can use both an absolute or relative path, your call
// If your website uses lots of (sub)folders, you could include your domain name
// Do not start with a slash, but do end with one!
// Use '..' to go up one folder
// If you wish to use our (remote) files in stead of your own local ones, use this value:
// $var_2banornot2ban_folder = 'http://80.61.36.70/2banornot2ban/data/';
// Do keep in mind that this might slow down the loading of your pages

$var_2banornot2ban_folder = 'data/';
// Default: $var_2banornot2ban_folder = 'data/';

// LIST FILE
// Change this value if you prefer to rename the name of the 'list' file
// You may also give it any extension, so you could name it, for example: 'black.list'
// This file should, however, be placed in the 'data' folder

$var_2banornot2ban_file = 'list';
// Default: $var_2banornot2ban_file = 'list';

// LOCKED FILE
// When a user is refused access to the page, the 'locked' page is displayed
// You may edit the 'locked' file just as you wish to, and you can change its name here
// Just as the 'list' file, the file should remain in the 'data' folder

$var_2banornot2ban_locked = 'locked.php';
// Default: $var_2banornot2ban_locked = 'locked.php';

/* ---------- ENDING OF THE GLOBAL CONFIGURATION ---------- */


// Warning: Do not edit anything from this point unless you know what you are doing!
// Load the IP addresses in the 'list' file into an array

$var_2banornot2ban_list = file($var_2banornot2ban_folder.$var_2banornot2ban_file);
// Save the guest's IP address to a variable for faster processing later on
$var_2banornot2ban_ip = $_SERVER['REMOTE_ADDR'];

// Remove any hidden and unwanted symbols in the IP array
foreach($var_2banornot2ban_list as $key => $value)
    {

    $var_2banornot2ban_list[$key] = trim($value);
    }


// If the function of this script is to use a whitelist...
if ($var_2banornot2ban_function == 1)
    {

    if (!in_array($var_2banornot2ban_ip, $var_2banornot2ban_list))
        {

        include($var_2banornot2ban_folder.$var_2banornot2ban_locked);
        die();
        }
    }


// If the function of this script is to use a blacklist...
if ($var_2banornot2ban_function == 2)
    {

    if (in_array($var_2banornot2ban_ip, $var_2banornot2ban_list))
        {

        include($var_2banornot2ban_folder.$var_2banornot2ban_locked);
        die();
        }
    }


?>


data/blocked.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
<?php
// VALIDATION
// A little security pre-caution
// This will prevent people from directly accessing pages that should be included
// If direct access would be granted, the page would be full of errors

if ((!isset($var_2banornot2ban_validation)) or ($var_2banornot2ban_validation !== 1))
    {

    die('Direct access to this page is not allowed...');
    }


echo 'You passed!';

?>


data/list
123.345.567.789

 
 

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.