';
var_dump($val);
echo '';
die();
}
function uuid () {
return sprintf(
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
mt_rand(0, 0xffff), mt_rand(0, 0xffff), // 32bitlow
mt_rand(0, 0xffff), // 16bitmid
mt_rand(0, 0x0fff) | 0x4000, // 16bithigh
mt_rand(0, 0x3fff) | 0x8000, // 16bit|8bithigh|low
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff) // 48bitnode
);
}
function isdomainexist (string $url): bool {
return inet_pton(gethostbyname(get_domain($url))) !== false;
}
function domainsecuritycheck (string $url): array {
$err = [];
// ホスト名のみかどうかチェック
if ($url !== parse_url($url, PHP_URL_SCHEME).'://'.parse_url($url, PHP_URL_HOST)) {
$err[] = 'URLは「http」又は「https」からTLDまでのみではありません。ご変更下さい。
URL is not limited to "http" or "https" to TLD. Please change.';
}
// ドメインは存在するかどうかチェック
if (!isdomainexist($url)) {
$err[] = 'このドメイン名は未登録みたいです。
This domain name seems to be unregistered.';
}
// ウエブページが移転されているかどうか
if (
(int)trim(shell_exec('curl -o /dev/null -s -w "%{http_code}\n" '.$url.' 2>&1') >= 301) &&
(int)trim(shell_exec('curl -o /dev/null -s -w "%{http_code}\n" '.$url.' 2>&1') <= 399)
) {
$err[] = 'ウェブサイトは移転されているみたいです。直接URLをご入力下さい。
The website seems to have been relocated. Please enter the URL directly.';
}
// ブラフレを使っているかどうかチェック
if (!is_null(shell_exec('whois '.get_domain($url).' | grep -i "cloudflare" 2>&1'))) {
$err[] = 'ウェブサイトはCloudFlareを使っているみたいです。追加依頼拒否。
The website seems to be using CloudFlare. Rejection of additional request.';
}
// Torブロックのチェック
if ((int)trim(shell_exec('torsocks curl -o /dev/null -s -w "%{http_code}\n" '.$url.' 2>&1') >= 400)) {
$err[] = 'ウェブサイトはTorで接続出来ないみたいです。追加依頼拒否。
The website doesn\'t seem to be able to connect with Tor. Rejection of additional request.';
}
// DOCTYPE htmlタグがあるかどうかチェック
if (is_null(shell_exec('curl -s -L '.$url.' | grep -i "<\!DOCTYPE html" 2>&1'))) {
$err[] = 'ウェブサイトは「!DOCTYPE html」タグを含めていません。
The website does not include the "! DOCTYPE html" tag.';
}
// titleタグがあるかどうかチェック
if (is_null(shell_exec('curl -s -L '.$url.' | grep -i "