Skip to content

Commit

Permalink
禁止ホストを設定できるようにした。
Browse files Browse the repository at this point in the history
  • Loading branch information
satopian committed Aug 1, 2022
1 parent d81bf69 commit d660e1e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
3 changes: 3 additions & 0 deletions petitnote/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@
$badstr_A = ['激安','低価','コピー','品質を?重視','大量入荷'];
$badstr_B = ['シャネル','シュプリーム','バレンシアガ','ブランド'];

//禁止ホスト
$badhost =['example.com','example.org'];

/*使用目的別設定*/

// 本文へのURLの書き込みを許可する
Expand Down
16 changes: 13 additions & 3 deletions petitnote/functions.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$functions_ver=20220801;
//編集モードログアウト
$functions_ver=20220718;
function logout(){
$resno=filter_input(INPUT_GET,'resno');
session_sta();
Expand Down Expand Up @@ -482,8 +482,18 @@ function deltemp(){

// NGワードがあれば拒絶
function Reject_if_NGword_exists_in_the_post(){
global $use_japanesefilter,$badstring,$badname,$badurl,$badstr_A,$badstr_B,$allow_comments_url,$admin_pass,$max_com,$en;

global $use_japanesefilter,$badstring,$badname,$badurl,$badstr_A,$badstr_B,$allow_comments_url,$admin_pass,$max_com,$en,$badhost;

//ホスト取得
$userip = get_uip();
$host = gethostbyaddr($userip);
//拒絶ホスト
foreach($badhost as $value){
if (preg_match("/$value\z/i",$host)) {
return error($en?'Post was rejected.':'拒絶されました。');
}
}

$adminpost=adminpost_valid();

$name = t((string)filter_input(INPUT_POST,'name'));
Expand Down

0 comments on commit d660e1e

Please sign in to comment.