Current time: 01-29-2021, 12:39 AM Hello There, Guest! (LoginRegister)


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
datei includen in /gui/index.php
Author Message
fulltilt Offline
Member
***

Posts: 1,225
Joined: Apr 2007
Reputation: 5
Post: #3
RE: datei includen in /gui/index.php
im debug bekomme ich keine fehler ... hab in den letzten 2 wochen massig logins von irgendwelchen idioten, wird von tag zu tag schlimmer ...
hier ist das script das ich includen möchte, auf einem normalen userweb funktioniert es so, im gui gibts eine blank page ...
PHP Code:
<?php

// Settings
$block_proxy_attemts        true;         // true or false
$log_proxy_attemts      true;         // true or false
$log_proxy_attemts_to   "blockedproxy.log";  // Filename or path with filename

// To use this on your own page, please add following line:
// if (block_proxys() == true AND $block_proxy_attemts == true) { exit("Proxys are not allowed to connect to this page, please connect directly"); }

// Please do not change any thing under this comment
function block_proxys()
{
    global 
$_SERVER$log_proxy_attemts$log_proxy_attemts_to;
    
$proxy_detected '0';
function 
block_proxys()
{
    global 
$_SERVER$log_proxy_attemts$log_proxy_attemts_to;
    
$proxy_detected '0';
    
$blockedheaders = array(
        
'HTTP_VIA',
        
'HTTP_X_FORWARDED_FOR',
        
'HTTP_FORWARDED_FOR',
        
'HTTP_X_FORWARDED',
        
'HTTP_FORWARDED',
        
'HTTP_CLIENT_IP',
        
'HTTP_FORWARDED_FOR_IP',
        
'VIA',
        
'X_FORWARDED_FOR',
        
'FORWARDED_FOR',
        
'X_FORWARDED',
        
'FORWARDED',
        
'CLIENT_IP',
        
'FORWARDED_FOR_IP',
        
'HTTP_PROXY_CONNECTION'
    
);


    foreach(
$blockedheaders as $i)
    {
        if (isset(
$_SERVER[$i])) { $proxy_detected++; $log .= $i.", "; }
    }


    if (
gethostbyname(ReverseIPOctets($_SERVER['REMOTE_ADDR']).".".$_SERVER['SERVER_PORT'].".".ReverseIPOctets($_SERVER['SERVER_ADDR']).".ip-port.exitlist.torproject.org") == "127.0.0.2")
    { 
$proxy_detected++; $log .= "TOR exit node, "; }

    if (
exists_in_rbl() == true)
    { 
$proxy_detected++; $log .= "RBL, "; }

    if (
$proxy_detected >= '1')
    {
        if (
$log_proxy_attemts == true)
        {
            if (
is_writable($log_proxy_attemts_to)) {
                
$fp fopen($log_proxy_attemts_to,"a");
                
fwrite($fp,date("Y-m-d H:i:s").": Proxy Server detected: ".gethostbyaddr($_SERVER['REMOTE_ADDR'])." (".$_SERVER['REMOTE_ADDR'].") - Info: ".$log."\n");
                
fclose($fp);
            } else {
                exit(
"Connection Logfile is not writeable");
            }
        }
        return 
true;
    }
    else
    {
        return 
false;
    }
}

function 
exists_in_rbl() {
    
$rbls = array('http.dnsbl.sorbs.net''misc.dnsbl.sorbs.net');
    
$remote getenv('REMOTE_ADDR');

    if (
preg_match("/([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/",
      
$remote$matches)) {
        foreach (
$rbls as $rbl) {
            
$rblhost $matches[4] . "." $matches[3] . "." .
                
$matches[2] . "." $matches[1] . "." $rbl;

            
$resolved gethostbyname($rblhost);

            if (
$resolved != $rblhost) {
                return 
true;
            }
        }
    }
    return 
false;
}

function 
ReverseIPOctets($inputip)
{
    
$ipoc explode(".",$inputip);
    return 
$ipoc[3].".".$ipoc[2].".".$ipoc[1].".".$ipoc[0];
}

?>

der include in die index.php
include_once("block_proxy.php");
if (block_proxys() == true AND $block_proxy_attemts == true) { exit(""); }
03-08-2012 04:18 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
RE: datei includen in /gui/index.php - fulltilt - 03-08-2012 04:18 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)