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: 10 years ago
Size: 606 bytes


Class file image Download


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