Files
tomtomgames/ref_test.php
T
2026-05-22 12:52:50 +00:00

27 lines
849 B
PHP

<?php
require_once __DIR__ . '/../includes/config.php';
require_once __DIR__ . '/../includes/db.php';
header('Content-Type: application/json');
// Test what the referrals API would return for each user
$users = db()->query("SELECT id, username, referral_code FROM users")->fetchAll();
$out = [];
foreach ($users as $u) {
$out[] = [
'id' => $u['id'],
'username' => $u['username'],
'referral_code' => $u['referral_code'],
'referral_url' => 'https://tomtomgames.com/?ref=' . $u['referral_code'],
];
}
// Also check tiers
$tiers = db()->query("SELECT id, name, min_referrals, tokens_per_ref, bonus_tokens, is_active FROM referral_tiers ORDER BY sort_order")->fetchAll();
echo json_encode([
'users' => $out,
'tiers' => $tiers,
'tier_count' => count($tiers),
], JSON_PRETTY_PRINT);