これでどうかな?(Re:xmobile 書込みがスパム判定

投稿ツリー

  • なし だめか??(Re:testing) (なーお, 2007/10/15 15:41)
  • なし だめじゃん(Re:xmobile& protectでスパム誤判定) (なーお, 2007/10/16 5:16)
  • なし これもだめ(Re:xmobile& protectスパム誤判定) (なーお, 2007/10/16 23:52)
  • なし これでいいかナ?(Re:xmobile& protectorスパム誤判定) (なーお, 2007/10/19 0:47)
  • なし Re: [xoops] xmobile 書込みが protectorでスパム判定される (長さん, 2009/4/25 9:04)
  • なし Re: [xoops] xmobile 書込みが protectorでスパム判定される (なーお, 2009/4/26 10:17)

  • このトピックの投稿一覧へ

    なーお

    なし これでどうかな?(Re:xmobile 書込みがスパム判定

    msg# 1.1
    depth:
    1
    前の投稿 - 次の投稿 | 親投稿 - 子投稿なし | 投稿日時 2007/10/15 13:33
    なーお  長老   投稿数: 1832 オンライン

    どうもこのプラグインの挙動が気になります。
    このロジックだと、 100文字(Defo時)以上の文字列の中に日本語がなければ、即スパム扱いです。

    ところが、xmobileなどURL文字列が長い場合には、例え本文に日本語が書いてあっても、日本語が1文字も無いURLの段階で判断され、スパムと判定されてしまいます。

    ループ抜けの判定は、「日本語があること」としておき、日本語があるときはフラグを立て、 ループ外でフラグの有無を評価する方が良さそうだけど。。 この考え、間違っているかなあ・・

    ***
    で、こんな感じかな。。
    一応、テストはしてみたけど、判定文字数下限値を、「100」を「40」にしても正常に日本語判定したし、日本語の無い書き込みはハネてくれた。

    元のコード

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    
    foreach( $_POST as $key => $data ) {
    	// dare to ignore arrays/objects
    	if( ! is_string( $data ) ) continue ;
    		$check_length = isset( $lengths[ $key ] ) ? $lengths[ $key ] : $lengths[ 0 ] ;
    		if( strlen( $data ) > $check_length ) {
    			if( strlen( $data ) == mb_strlen( $data ) )  {
    				$this->protector->message .= "No multibyte character was found ($data)\n" ;
    				$this->protector->output_log( 'Singlebyte SPAM' , 0 , false , 128 ) ;
    				die( 'Protector rejects your post, because your post looks like SPAM' ) ;
    			}
    			if( strlen( $data ) > mb_strlen( $data ) )  {
    				$multibyte_ok = true;
    				break;
    			}
    		}
    	}
    }

    変更後のコード

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    
    $multibyte_ok = false;
    foreach( $_POST as $key => $data ) {
    	// dare to ignore arrays/objects
    	if( ! is_string( $data ) ) continue ;
    		$check_length = isset( $lengths[ $key ] ) ? $lengths[ $key ] : $lengths[ 0 ] ;
    		if( strlen( $data ) > $check_length ) {
    			if( strlen( $data ) > mb_strlen( $data ) )  {
    				$multibyte_ok = true;
    				break;
    			}
    		}
    	}
    	if( $multibyte_ok == false) {
    		$this->protector->message .= "No multibyte character was found ($data)\n" ;
    		$this->protector->output_log( 'Singlebyte SPAM' , 0 , false , 128 ) ;
    		die( 'Protector rejects your post, because your post looks like SPAM' ) ;
    	}
    }
    投票数:0 平均点:0.00
    返信する

    この投稿に返信する

    題名
    ゲスト名
    投稿本文

      条件検索へ