Skip to content

Commit 4bf5e32

Browse files
committed
ipアドレスか、ipv4アドレスか。
1 parent 5645b8c commit 4bf5e32

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

petitnote/functions.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
$functions_ver=20250608;
2+
$functions_ver=20250613;
33
//編集モードログアウト
44
function logout(): void {
55
session_sta();
@@ -628,6 +628,9 @@ function get_uip(): string {
628628
$ips = explode(', ', $ip);
629629
$ip = $ips[0];
630630
}
631+
if(filter_var($ip, FILTER_VALIDATE_IP) === false){
632+
return $ip = '';
633+
}
631634
return $ip;
632635
}
633636

@@ -1188,8 +1191,10 @@ function is_badhost(): bool {
11881191

11891192
if($host === $userip){//ホスト名がipアドレスになる場合は
11901193
if($reject_if_no_reverse_dns){
1191-
$_SESSION['is_badhost'] = true;
1192-
return true; //リバースDNSがない場合は拒絶
1194+
if(filter_var($userip, FILTER_VALIDATE_IP,FILTER_FLAG_IPV4)){//IPv4アドレスなら
1195+
$_SESSION['is_badhost'] = true;
1196+
return true; //リバースDNSがない場合は拒絶
1197+
}
11931198
}
11941199
foreach($badhost as $value){
11951200
if (preg_match("/\A$value/i",$host)) {//前方一致

petitnote/index.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22
//Petit Note (c)さとぴあ @satopian 2021-2025
33
//1スレッド1ログファイル形式のスレッド式画像掲示板
4-
$petit_ver='v1.91.2';
5-
$petit_lot='lot.20250609';
4+
$petit_ver='v1.91.3';
5+
$petit_lot='lot.20250613';
66

77
$lang = ($http_langs = $_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? '')
88
? explode( ',', $http_langs )[0] : '';
@@ -18,7 +18,7 @@
1818
die(__DIR__.'/functions.php'.($en ? ' does not exist.':'がありません。'));
1919
}
2020
require_once(__DIR__.'/functions.php');
21-
if(!isset($functions_ver)||$functions_ver<20250608){
21+
if(!isset($functions_ver)||$functions_ver<20250613){
2222
die($en?'Please update functions.php to the latest version.':'functions.phpを最新版に更新してください。');
2323
}
2424

0 commit comments

Comments
 (0)