Login   Register  
PHP Classes
elePHPant
Icontem

File: Examples/proxydetect.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Volkan Küçükçakar  >  XIP Class  >  Examples/proxydetect.php  >  Download  
File: Examples/proxydetect.php
Role: Example script
Content type: text/plain
Description: Example 1 - Proxy type, proxy info, client IP detection
Class: XIP Class
Analyze remote IP, Proxy detection,Blacklist check
Author: By
Last change: -Bug Fixed in IP octet pattern -Added Example 3: Blacklist (Local) - Another local blacklist example using an external flat text file -Added Example 4: IP Log - IP Log example using a flat text file (with exclusive file lock support via flock and semaphore files) -Added Example 5: Blacklist (Check RBL) - Checking the existance of visitor's IP in RBL (Real-Time Blackhole List) using 3rd party services
Date: 2006-08-21 07:27
Size: 3,695 bytes
 

Contents

Class file image Download
<?
/**
 XIP Class - Proxy Detection and IP Functions class for PHP - File Name: proxydetect.php
 Copyright (C) 2004-2006 Volkan Küçükçakar. All Rights Reserved.
 (Volkan Kucukcakar)
 http://www.developera.com

 You are requested to retain this copyright notice in order to use
 this software.

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the  Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
?>
<?     
/*
       XIP Class - EXAMPLE 1 - proxydetect.php
       This example demonstrates:
       Proxy type, proxy info, client IP detection
       */
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<title>XIP Class - developera.com/xip</title>
<body bgcolor="#FFFFFF" text="#000000">
<center>
<p>Proxy Detection | <a href="ipfunctions.php">IP Functions</a> | <a href="blacklist_local.php">Blacklist (Local)</a> | <a href="iplog.php">IP Log</a> | <a href="CheckRBL.php">Blacklist (Check RBL)</a></p>
<p align="left"><font color="#FF6666">XIP Class - EXAMPLE 1 - proxydetect.php - </font><font color="#707070">Proxy type, proxy info, client IP detection </font></p>
<p>&nbsp; </p>
  <table width="600" border="1" cellspacing="0" cellpadding="0">
    <tr>
      <td width="200">Proxy Detected</td>
      <td width="400">&nbsp;

<?
   
require('../class.XIP.php');
   
$XIP=new XIP();
   if (
$XIP->Proxy['detected']){
        echo 
"DETECTED";
   }elseif (
$XIP->Proxy['suspicious']){
           echo 
"SUSPICIOUS";
   }else{
       echo 
"NOT DETECTED";
   }
?>

      </td>
    </tr>
    <tr>
      <td>Proxy IP </td>
      <td>&nbsp;

<? echo $XIP->IP['proxy']; ?>

      </td>
    </tr>
    <tr>
      <td>Client IP </td>
      <td>&nbsp;
      
<? echo $XIP->IP['client']; ?>
      
      </td>
    </tr>
    <tr>
      <td>All IP addresses captured </td>
      <td>&nbsp;

<? echo $XIP->IP['all']; ?>
      
      </td>
    </tr>
    <tr>
      <td>Proxy Type </td>
      <td>&nbsp;
      
<?
   
if ($XIP->Proxy['anonymous']) {
       echo 
"ANONYMOUS";
   }else{
       echo 
"TRANSPARENT";
   }
?>
      
      </td>
    </tr>
    <tr>
      <td>Proxy Name </td>
      <td>&nbsp;

<? echo $XIP->Proxy['name']; ?>
      
      </td>
    </tr>
    <tr>
      <td>Proxy Info </td>
      <td>&nbsp;
<?
   
foreach($XIP->Proxy['info'] as $key=>$value){
      echo 
"$key=$value<br>";
   }
?>
      </td>
    </tr>
    <tr>
      <td>Proxy Headers </td>
      <td>&nbsp;
<?
   
foreach($XIP->Proxy['headers'] as $key=>$value){
      echo 
"$key=$value<br>";
   }
?>
      </td>
    </tr>
  </table>

  <p>&nbsp; </p>
  <p><strong>XIP Class<br>
  </strong>Proxy Detection and IP Functions class for PHP<strong><br>
  </strong><a href="http://www.developera.com/xip">www.developera.com/xip</a></p>
  <p>&nbsp; </p>
</center>
</body>
</html>