<?php
    error_reporting(E_ALL ^ E_DEPRECATED);
    mysqli_report(MYSQLI_REPORT_OFF);
    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,
            "SameSite" => "None"
        );
        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,$categories,$comment) {
        global $abuseipdb_apikey;
        $data = array(
            "ip" => $ip,
            "categories" => $categories,
            "comment" => $comment
        );
        $headers =  array(
            'Key: '.$abuseipdb_apikey,
            'Accept: application/json'
        );
        $curlObj = curl_init('https://api.abuseipdb.com/api/v2/report'); 
        curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curlObj, CURLOPT_POST, true);
        curl_setopt($curlObj, CURLOPT_POSTFIELDS, $data);
        curl_setopt($curlObj, CURLOPT_HTTPHEADER, $headers);
        $curl_response = curl_exec($curlObj);
        //var_dump($curl_response);
        curl_close($curlObj);
    }

    function abuseipdbcheckip($ip) {
        global $abuseipdb_apikey;
        $headers = array(
            'Key: ' . $abuseipdb_apikey,
            'Accept: application/json'
        );
        $curlObj = curl_init('https://api.abuseipdb.com/api/v2/check?ipAddress='.$ip.'&maxAgeInDays=7');
        curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curlObj, CURLOPT_HTTPGET, 1);
        curl_setopt($curlObj, CURLOPT_HTTPHEADER, $headers);
        $curl_response = curl_exec($curlObj);
        $ret = print_r($curl_response,true);
        curl_close($curlObj);
        return $ret;
    }
?>
<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";

    include "include/ipwhitelist.php";
    
    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(48) 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=utf8mb4 collate=utf8mb4_bin") or die(mysqli_error($db_link));
            }
            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));
                abuseipdbreportip($ip,"19","Automatic Report: Ignores robots.txt, visited bot-trap page linked through a hidden link, auto-banned");
            } 
            $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'] > -1 && $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);
    
?>

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