<?php
     $file = 'counter.dat';

// 读取并自增
$counter = (int)@file_get_contents($file);
$counter++;

// 使用 LOCK_EX 防止并发写入冲突
file_put_contents($file, $counter, LOCK_EX); 
 ?>
 
<?php
error_reporting(E_ALL & ~E_NOTICE);
header('Content-Type: text/plain');

$qq = $_GET['qq'] ?? '';

if (is_numeric($qq) && $qq !== '') {
    header('Cache-Control: public, max-age=86400');
    header('Location: https://q1.qlogo.cn/g?b=qq&nk='.$qq.'&s=100');
} else {
    http_response_code(400);
    echo '缺少有效的QQ号码参数';
}
?>