Compare commits
No commits in common. "main" and "img-v1" have entirely different histories.
20
index.php
20
index.php
@ -1,24 +1,4 @@
|
||||
<?php
|
||||
$allowedRefererDomains = [
|
||||
'8.140.229.121',
|
||||
'154.9.228.54',
|
||||
];
|
||||
|
||||
$designatedImagePath = 'doge.jpg';
|
||||
|
||||
if (isset($_SERVER['HTTP_REFERER'])) {
|
||||
$refererUrl = $_SERVER['HTTP_REFERER'];
|
||||
$refererHost = parse_url($refererUrl, PHP_URL_HOST);
|
||||
if (in_array($refererHost, $allowedRefererDomains)) {
|
||||
if (file_exists($designatedImagePath) && is_readable($designatedImagePath)) {
|
||||
$imageMimeType = mime_content_type($designatedImagePath);
|
||||
header('Content-Type: ' . $imageMimeType);
|
||||
readfile($designatedImagePath);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
include('config.php');
|
||||
|
||||
// 安全地获取API名称
|
||||
|
Loading…
Reference in New Issue
Block a user