<?php
    error_reporting
(E_ALL E_DEPRECATED);
    include 
"include/variables.php";
    include 
"include/functions.php";
    include 
"include/errors.php";
    include 
"include/getip.php";
    
$PHP_SELF=$_SERVER['PHP_SELF'];
    if (isset(
$_SERVER['HTTP_ACCEPT_ENCODING']) && substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
        if (
ob_get_length()) ob_end_clean();
        
ob_start("ob_gzhandler");
    }
    else 
ob_start();
    if (!empty(
$_SERVER['HTTPS'])) {
        
$session_options = array(
            
"secure" => true
        
);
        
session_set_cookie_params($session_options);
    }
    
session_start();
    
    include 
"include/badbots.php";
    
$evt="403";
    
header($_SERVER['SERVER_PROTOCOL']." 403 Forbidden");
    include 
"include/iplog.php";
    
    
$action="";
    function 
abuseipdbreportip($ip,$comment) {
        global 
$abuseipdb_apikey;
        
$data = array(
            
"ip" => $ip,
            
"categories" => "19",
            
"comment" => $comment
        
);
        
$headers =  array(
            
'Key: '.$abuseipdb_apikey,
            
'Accept: application/json'
        
);
        
$curlObj curl_init('https://api.abuseipdb.com/api/v2/report'); 
        
curl_setopt($curlObjCURLOPT_RETURNTRANSFERtrue);
        
curl_setopt($curlObjCURLOPT_POSTtrue);
        
curl_setopt($curlObjCURLOPT_POSTFIELDS$data);
        
curl_setopt($curlObjCURLOPT_HTTPHEADER$headers);
        
$curl_response curl_exec($curlObj);
        
//var_dump($curl_response);
        
curl_close($curlObj);
    }
?>
<html>
<head>
    <title>TRESPASSERS WILL BE SHOT. SURVIVORS WILL BE SHOT AGAIN</title>
</head>
<body><h3>TRESPASSERS WILL BE SHOT. SURVIVORS WILL BE SHOT AGAIN</h3>
If You are here this means you violated the main internet rule for not visiting places where is strictly forbidden.
<hr><?php
    
echo "Detected IP and User Agent (Logged): $ip ".(isset($_SERVER['HTTP_USER_AGENT'])?$_SERVER['HTTP_USER_AGENT']:"")."<br>\n";

    
//$whitelist[]="66.249.71.247"; //google ip 1
    //$whitelist[]="195.113.214.211"; //Jyxobot
    //$whitelist[]="::1"; //ipv6 localhost
    
    
if (!file_exists("include/db.php")) {
        
$action="DB Not Ready";
        
$msg="Warning: Database not ready, auto-banning disabled.";
    } elseif (isset(
$whitelist) && in_array($ip$whitelist)) {
        
$action "Ignore";
        
$msg="Watch Out For Mines Here and There Around.";
    } else {
        include 
"include/db.php";
        if(
$db_link){
            
$update false;
            
mysqli_select_db($db_link,$db);
            
$table="bans";
            
//create ban list table
            
if(!mysqli_query($db_link,"desc $table")){ 
                
$result=mysqli_query($db_link,"create table $table (id int not null auto_increment primary key, ip varchar(16) not null default '', timestamp int not null default 0, expires int not null default 0, exclude int not null default 0, comment text not null) default charset=utf8 collate=utf8_unicode_ci") or die(mysqli_error($db_link));
            }
            else {
                if (
mysqli_num_rows(mysqli_query($db_link,"select * from $table where ip='$ip'"))>0){ //ip in db
                    
$msg"Warning: Duplicate IP Found: Possibly already banned and/or invalid IP Detected";
                    
$action="Dupe Found";
                } else {
                    
$action "Ban";
                    
$msg="Killed (whitch means Automatically Banned) for violating the main rule of thy internet.";
                    
$update true;
                    
$timestamp=time();
                    
mysqli_query($db_link,"insert into $table (ip,timestamp,expires,exclude,comment) values ('$ip','$timestamp.','".($timestamp+60*60*24*2)."','0','')") or die(mysqli_error($db_link));
                } 
            }
            
$result=mysqli_query($db_link,"select * from $table order by ip");
            if (
mysqli_num_rows($result) > 0) {
                while(
$ban=mysqli_fetch_assoc($result)){
                    
//bans expiration
                    
if ($ban['expires'] > -&& $ban['expires'] < time()) {
                        
mysqli_query($db_link,"delete from $table where ip='".$ban['ip']."'");
                        
$update true;
                    }
                }
            }
            if (
$update) {
                
//read all bans
                
$result=mysqli_query($db_link,"select ip from $table order by ip");
                
$bans="";
                if (
mysqli_num_rows($result) > 0) {
                    while(
$ban=mysqli_fetch_assoc($result)){
                        
$bans.= "Deny from ".$ban['ip']."\n";
                    }
                }
                
//update htaccess
                
$out="$htaccess_header\n$errordoc\n$rewrite_rules\n$badbots\nOrder Allow,Deny\nAllow from all\nDeny from env=bad_bot\n$badips\n$bans";
                
$file=fopen(".htaccess","w");
                
fwrite($file$out);
                
fclose($file);
            }
            
mysqli_close($db_link);
        }
    }
    echo 
"$msg<br>\n";
    if (isset(
$tmp)) unset ($tmp);
    
$log=fopen("logs/bottrap.txt""a");
    
fwrite($log"[".date("Y-m-d H:i:s")."] [".$ip.(!empty($host)?(" ".$host):"")."] [$action]\n".(isset($_SERVER['HTTP_USER_AGENT'])?$_SERVER['HTTP_USER_AGENT']:"")."\n\n");  
    
fclose($log);
    
abuseipdbreportip($ip,"Automatic Report: Ignores robots.txt, visited bot-trap page linked though a hidden link, auto-banned");
    
?>

You can also check other includes below (some files are hidden as they are in exclusion list):
functions.php
errors.php
getip.php
iplog.php