PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Kreshnik Hasanaj   IP Blocking Class   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: IP Blocking class example code
Class: IP Blocking Class
Block the access of users from given IP addresses
Author: By
Last change:
Date: 11 years ago
Size: 606 bytes
 

Contents

Class file image Download
<?php

include('ipblocker.php');

/* This is a sample code on how the class can be used */
$ipBlock = new IPBlocker($_SERVER['REMOTE_ADDR']); //Create object
$ipBlock->denyIPAddress = '127.0.0.1'; //Block single IP address
$ipBlock->denyIPAddresses = array($_SERVER['REMOTE_ADDR'], '127.0.0.254'); //Block multiple IP addresses
$ipBlock->beginRange = '127.0.0.1'; //Block IP range
$ipBlock->endRange = '127.0.0.254'; //Block IP range
$ipBlock->logBlocking = true; //Log blocking
$ipBlock->fileName = 'block.txt'; //Save blocking into this file
$ipBlock->start_blocking(); //Start blocking

?>