Login   Register  
PHP Classes
elePHPant
Icontem

File: sIPb.doc

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Uwe Stein  >  sIPb  >  sIPb.doc  >  Download  
File: sIPb.doc
Role: Documentation
Content type: text/plain
Description: The documentation
Class: sIPb
Block the IP address of undesired HTTP clients
Author: By
Last change:
Date: 9 years ago
Size: 2,436 bytes
 

Contents

Class file image Download
++++++++++++++++++++++Overview:++++++++++++++++++++++
sIPb means  (s)imple (IP) (b)locker

The sIPb-object provides a easy way to handle unwelcome clients at your site. It saved the IP of these clients with a fixed number of seconds to be blocked from your site. 

The sIPb-object automatically updates the stored entries by deleting expired lines. If you want to do so, the SIPb-object redirects blocked clients to a specified URL, or it provides only the information that a client is blocked. 




To see sIPb work:
   -Just unpack the package to your http dir
   -start sIPb_Sample.php

++++++++++++++++++++++The Package contains:++++++++++++++++++++++++++++
sIPb.doc               --> this file
sIPb.php	       --> Contains the object class sIPb
sIPb_Sample.php        --> a Demo to see sIPb working
sIPb_SamplePart2.php   -->  Demo Part 2 ( sIPb without redirection )
sIPb_SamplePart3.php   -->  Demo Part 3 ( sIPb with redirection )
ur_blocked.html        -->  Targed for Demo Part 3



class sIPb {

  
  var $blockFile;  
  var $blockUrl;
    * both defined in sIPb.conf.php
    * blockFile is the URL of the file which contains the stored IPs 
    * blockUrl contains the URL where to the blocked clients are redirected
  
    
  function sIPb($withCheck = FALSE) 
    *  sIPb([boolean withCheck = FALSE ]):void
    *  Create a sIPb-objekt, if withCheck == TRUE automatically check 
    *  wether the client-IP is blocked and redirect to "BLOCK_URL"
    *  ( if withCheck == TRUE, remember that "header(location..." only
    *  works if there was no output before ) 
    *    
    *  if withCheck == FALSE you may call the func isBlocked() to check 
    *  wether the client's IP is blocked or not
    *
    *  Param : opt. boolean withCheck ( default FALSE )
    *  Return: void 
    
  
   
  function blockIP($seconds = 86400)
    *  blockIP([seconds]):boolean
    *  gets the current IP and saves it in "blocked-IP's file 
    *  
    *  Param : seconds to block the IP default 24 hours
    *  Return: boolean  
      
  
  
  
  function isBlocked()   
    *  isBlocked() : boolean
    *  checks wether the clients-IP is blocked or not 
    *  param : void 
    *  return: boolean
    
  
  function _cleanFile()     
    *  _cleanFile() : void
    *  read the blockFile and delete all expired entries 
    *  private method, called by the constructor
    *  
    *  Param : void 
    *  Return: void    
} // class sIPb