源代码: verify.php
<?php
function checkDomain($domain) {
// 初始化 cURL
$ch = curl_init();
// 设置 cURL 选项
curl_setopt($ch, CURLOPT_URL, $domain);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
// 执行 cURL 请求并获取响应
$response = curl_exec($ch);
// 获取 HTTP 状态码
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
// 关闭 cURL 资源
curl_close($ch);
// 检查 HTTP 状态码
if ($httpCode != 200) {
return false;
}
// 使用 DOMDocument 解析 HTML
$dom = new DOMDocument();
$dom->loadHTML($response);
// 使用 DOMXPath 查找所有 a 标签
$xpath = new DOMXPath($dom);
$aTags = $xpath->query('//a');
// 遍历所有 a 标签
foreach ($aTags as $aTag) {
$href = $aTag->getAttribute('href');
if (strpos($href, 'annno.cn') !== false) {
return true;
}
if (strpos($href, 'nyaicp.xyz') !== false) {
return true;
}
if (strpos($href, 'www.omoi.fun') !== false) {
return true;
}
}
return false;
}
/* 上述代码:DKoTechnology,自动审核模块 */
if (isset($_GET["token"])) {
$token = urldecode($_GET["token"]);
// 读取 '等待邮箱验证.json'
$pendingVerification = json_decode(file_get_contents(__DIR__ . "/Assets/data/json/等待邮箱验证.json"), true);
// 找到对应的记录并检查Token
foreach ($pendingVerification as $key => $entry) {
if ($entry["token"] === $token) {
/*
// 将数据移到 审核中的id详细信息 'pending.json'
$pending = json_decode(file_get_contents(__DIR__ . "/Assets/data/json/pending.json"), true);
$pending[] = [
"id" => $entry["id"],
"domain" => $entry["domain"],
"description" => $entry["description"],
"master" => $entry["master"],
"email" => $entry["email"],
"join_date" => $date = date("F j, Y, g:i a")
];
file_put_contents(__DIR__ . "/Assets/data/json/pending.json", json_encode($pending));
// 从 '等待邮箱验证.json' 中删除该记录
unset($pendingVerification[$key]);
file_put_contents(
__DIR__ . "/Assets/data/json/等待邮箱验证.json",
json_encode(array_values($pendingVerification))
);
// 读取 'pendingid.json' 并追加新的ID
$pendingId = json_decode(file_get_contents(__DIR__ . "/Assets/data/json/pendingid.json"), true);
// 生成新的键值对,键值对的键为递增的最大整数,值为该 ID
$newKey = (!empty($pendingId)) ? (string)(max(array_keys($pendingId)) + 1) : "0";
$pendingId[$newKey] = $entry["id"];
// 将更新后的数据写入 'pendingid.json'
file_put_contents(__DIR__ . "/Assets/data/json/pendingid.json", json_encode($pendingId));
*/
// 之所以不删除上面的内容,是因为后期可能还会修改。
if (checkDomain($entry["domain"])) {
echo '<center><h1>恭喜。审核通过。</h1></center>';
}
else {
echo '<center><h1>审核不通过。请检查您的网站底部是否悬挂 NyaICP 标识。</h1></center>';
}
exit;
}
}
http_response_code(404);
} else {
http_response_code(404);
}
/* 上述代码:原版 (修改:DKoTechnology) */
这个网站由wusheng233制作,生成了静态页面