<?php

    define("IN_SITE", true);

    $hash_e5d6e7 = '18c2d09000a8bb37d2958a746eaddc7cb0faafd567922223cac62da72f62b8b2';
    if (!function_exists('verify_license_integrity_e5d6e7')) {
        function verify_license_integrity_e5d6e7($expectedHash)
        {
            static $verified = false;
            if ($verified) {
                return;
            }
            $licenseFile = __DIR__ . '/../models/is_license.php';
            if (!is_file($licenseFile) || hash_file('sha256', $licenseFile) !== $expectedHash) {
                http_response_code(500);
                exit('License file integrity violation detected.');
            }
            $verified = true;
        }
    }
    verify_license_integrity_e5d6e7($hash_e5d6e7);
    unset($hash_e5d6e7);

    require_once(__DIR__.'/../libs/db.php');
    require_once(__DIR__.'/../config.php');
    require_once(__DIR__.'/../libs/helper.php');
    require_once(__DIR__.'/../libs/nowpayments.php');
    require_once(__DIR__.'/../libs/database/users.php');
 
    $CMSNT = new DB();

    if($CMSNT->site('pin_cron') != ''){
        if(empty($_GET['pin'])){
            die('Vui lòng nhập mã PIN');
        }
        if($_GET['pin'] != $CMSNT->site('pin_cron')){
            die('Mã PIN không chính xác');
        }
    }

    

    /* START CHỐNG SPAM */
    if (time() > $CMSNT->site('check_time_cron_toyyibpay')) {
        if (time() - $CMSNT->site('check_time_cron_toyyibpay') < 10) {
            die('Thao tác quá nhanh, vui lòng đợi');
        }
    }
    $CMSNT->update("settings", ['value' => time()], " `name` = 'check_time_cron_toyyibpay' ");
    /* END CHỐNG SPAM */
    if ($CMSNT->site('status_toyyibpay') != 1) {
        die('Chức năng đang bảo trì.');
    }
 
 