2: 2017-02-14 (火) 20:14:09 nao-pon | 現: 2017-02-14 (火) 21:57:55 nao-pon | ||
---|---|---|---|
Line 18: | Line 18: | ||
- online テーブルの online_ip カラムの文字数拡張(39文字) | - online テーブルの online_ip カラムの文字数拡張(39文字) | ||
+ | - protector モジュールの class/protector.php ip_match() の IPv6 対応(後述) | ||
- protector モジュールの一般設定 信頼できる IP に ^::1$ と ^fe80:: を追加 | - protector モジュールの一般設定 信頼できる IP に ^::1$ と ^fe80:: を追加 | ||
- protector モジュールの管理画面の BadIP のリストアップとその保存処理で、有効時間とIPのセパレーターを ":" から "-" に変更(trust/modules/protector/admin/index.php) | - protector モジュールの管理画面の BadIP のリストアップとその保存処理で、有効時間とIPのセパレーターを ":" から "-" に変更(trust/modules/protector/admin/index.php) | ||
Line 26: | Line 27: | ||
- protector の BadIP の登録で IPv6 のプレフィクス長を管理画面で指定できるようにする。 | - protector の BadIP の登録で IPv6 のプレフィクス長を管理画面で指定できるようにする。 | ||
+ | |||
+ | ** 詳細メモ [#c7b0e9f9] | ||
+ | |||
+ | *** class/protector.php ip_match() [#v00f8c71] | ||
+ | #code(php,366-){{ | ||
+ | function ip_match( $ips ) | ||
+ | { | ||
+ | foreach( $ips as $ip => $info ) { | ||
+ | if( $ip ) { | ||
+ | $ip = strtolower($ip); | ||
+ | switch( substr( $ip , -1 ) ) { | ||
+ | case '.' : | ||
+ | case ':' : | ||
+ | // foward match | ||
+ | if( substr( @$_SERVER['REMOTE_ADDR'] , 0 , strlen( $ip ) ) == $ip ) { | ||
+ | $this->ip_matched_info = $info ; | ||
+ | return true ; | ||
+ | } | ||
+ | break ; | ||
+ | case '0' : | ||
+ | case '1' : | ||
+ | case '2' : | ||
+ | case '3' : | ||
+ | case '4' : | ||
+ | case '5' : | ||
+ | case '6' : | ||
+ | case '7' : | ||
+ | case '8' : | ||
+ | case '9' : | ||
+ | case 'a' : | ||
+ | case 'b' : | ||
+ | case 'c' : | ||
+ | case 'd' : | ||
+ | case 'e' : | ||
+ | case 'f' : | ||
+ | // full match | ||
+ | if( @$_SERVER['REMOTE_ADDR'] == $ip ) { | ||
+ | $this->ip_matched_info = $info ; | ||
+ | return true ; | ||
+ | } | ||
+ | break ; | ||
+ | default : | ||
+ | // perl regex | ||
+ | if( @preg_match( $ip , @$_SERVER['REMOTE_ADDR'] ) ) { | ||
+ | $this->ip_matched_info = $info ; | ||
+ | return true ; | ||
+ | } | ||
+ | break ; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | $this->ip_matched_info = null ; | ||
+ | return false ; | ||
+ | } | ||
+ | }} | ||
RIGHT:&font(90%){&page_comments;}; | RIGHT:&font(90%){&page_comments;}; | ||
#navi | #navi |
ぺージ情報 | |
---|---|
ぺージ名 : | nao-pon/blog/2017-02-14 |
ページ別名 : | 未設定 |
ページオーナー : | nao-pon |
閲覧可 | |
グループ : | すべての訪問者 |
ユーザー : | すべての訪問者 |
編集可 | |
グループ : | なし |
ユーザー : | ゲスト |