-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
30 lines (23 loc) · 923 Bytes
/
index.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
<?php
/*
* This is a short script that limits page views based on remote address.
* With this script you can allow or deny access to any certain webpage or host based on the remote address.
* Define the CIDR ranges you want to allow and the script will take care of the rest
*
* This can be used as a helper class by changing the boolean $helper to true
*
* Johannes Edgren [Arcada] 2022
*/
// Require the ipValidator class
require "ipValidator.php";
// Read config file
$config = parse_ini_file("cidr.ini");
$ipValidator = new ipValidator($config['debug'], $config['helper'], $config['ipv4'], $config['ipv6']);
$ipState = $ipValidator->checkIfUserIsOnEduroam();
if($config['helper'] && $ipState){
// Do stuff here if you have set the type to helper class and the ip validates correctly
echo "I like marbles";
}else{
// Do evil stuff here if user is a skurk
echo "You are not welcome here";
}