kgsdev/killbot.pw

此包的最新版本(1.0.0)没有可用的许可证信息。

killbot.pw 的包装器

1.0.0 2022-08-29 00:38 UTC

This package is not auto-updated.

Last update: 2024-09-24 08:38:04 UTC


README

通过键入以下命令安装依赖项

composer require kgsdev/killbot.pw

创建文件 index.php 并粘贴以下代码

<?php

require_once __DIR__ . '/vendor/autoload.php';

use Kgsdev\Killbot;

class MyKillBot extends Killbot
{
  /**
   * apiKey
   *
   * KILLBOT.PW APIKEY
   * find your key at: https://killbot.org/dashboard
   * 
   * @return string
   */
  public function apiKey()
  {
    return '';
  }

  /**
   * url for allowed visitor
   * redirect if the visitor isnt bot
   * 
   * @return string
   */
  public function botRedirect()
  {
    return 'https://google.com';
  }

  /**
   * whiteLists
   *
   * list of white listed IPS
   * 
   * @return array
   */
  public function whiteLists()
  {
    return [
      '127.0.0.1'
    ];
  }

  /**
   * logsFile
   * 
   * log file name
   * 
   * @return void
   */
  public function logsFile()
  {
    return 'visitor.logs';
  }

  public function __invoke()
  {
    if (collect($this->whiteLists())->contains($this->ipv4())) {
      return $this->writeLog(['WHITE LISTED!']);
    }

    if ($this->botRedirect() != $this->currentURL()) {
      $this->runBlocker();
    }
  }
}