• 24-08-2010, 18:01:39
    #1
    Merhaba arkdaşlar, herhangi bir eklenti olmadan yorumlara doğrulama koymak istiyorum....

    2+5 gibi işlemler olabilir. Veya resim doğrulaması olabilir.

    Bunu nasıl yapabilirim acaba?
  • 24-08-2010, 19:51:25
    #2
    Üyeliği durduruldu
    Eklentisi Var math-comment-spam-protection

    Ama Diğerini bilmiyorum..
  • 24-08-2010, 20:04:30
    #3
    Eklenti olarak çok var özellikle resim doğrulama ama eklenti olmadan basit bir matematik işlemi koymak istiyorum

    Yardımlarınızı bekliyorum
  • 24-08-2010, 20:38:04
    #4
    functions.php ye ekle

    add_action( 'comment_form', 'add_hidden_fields' );
            function add_hidden_fields() {
                $mathvalue0 = rand(2, 15);
                $mathvalue1 = rand(2, 15);
          echo '<div><b>IMPORTANT!</b> To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-) <br/><br/>';
                echo "What is $mathvalue0 + $mathvalue1 ?<br/>";            
                echo '<input type="text" name="mathvalue2" value="" />';
                echo '</div>';
                echo '<div style="display:none">Please leave these two fields as-is: ';
                echo "<input type='text' name='mathvalue0' value='$mathvalue0' />";
                echo "<input type='text' name='mathvalue1' value='$mathvalue1' />";
                echo '</div>';
            }
            add_filter( 'preprocess_comment', 'preprocess_comment' );
            function preprocess_comment( $commentdata ) {
                check_hidden_fields();
                return $commentdata;
            }
                    function check_hidden_fields() {
                // Get values from POST data
                $val0 = '';
                $val1 = '';
                $val2 = '';
                if ( isset( $_POST['mathvalue0'] ) ) {
                    $val0 = $_POST['mathvalue0'];
                }
                if ( isset( $_POST['mathvalue1'] ) ) {
                    $val1 = $_POST['mathvalue1'];
                }
                if ( isset( $_POST['mathvalue2'] ) ) {
                    $val2 = $_POST['mathvalue2'];
                }
                
                // Check values
                if ( ( $val0 == '' ) || ( $val1 == '' ) || ( intval($val2) != (intval($val0) + intval($val1)) ) ) {
                    // Die and return error 403 Forbidden
                    wp_die( 'Bye Bye, SPAMBOT!', '403 Forbidden', array( 'response' => 403 ) );
                }
            }
  • 24-08-2010, 20:41:06
    #5
    Googital.com
    niphell adlı üyeden alıntı: mesajı görüntüle
    functions.php ye ekle

    add_action( 'comment_form', 'add_hidden_fields' );
            function add_hidden_fields() {
                $mathvalue0 = rand(2, 15);
                $mathvalue1 = rand(2, 15);
          echo '<div><b>IMPORTANT!</b> To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-) <br/><br/>';
                echo "What is $mathvalue0 + $mathvalue1 ?<br/>";            
                echo '<input type="text" name="mathvalue2" value="" />';
                echo '</div>';
                echo '<div style="display:none">Please leave these two fields as-is: ';
                echo "<input type='text' name='mathvalue0' value='$mathvalue0' />";
                echo "<input type='text' name='mathvalue1' value='$mathvalue1' />";
                echo '</div>';
            }
            add_filter( 'preprocess_comment', 'preprocess_comment' );
            function preprocess_comment( $commentdata ) {
                check_hidden_fields();
                return $commentdata;
            }
                    function check_hidden_fields() {
                // Get values from POST data
                $val0 = '';
                $val1 = '';
                $val2 = '';
                if ( isset( $_POST['mathvalue0'] ) ) {
                    $val0 = $_POST['mathvalue0'];
                }
                if ( isset( $_POST['mathvalue1'] ) ) {
                    $val1 = $_POST['mathvalue1'];
                }
                if ( isset( $_POST['mathvalue2'] ) ) {
                    $val2 = $_POST['mathvalue2'];
                }
                
                // Check values
                if ( ( $val0 == '' ) || ( $val1 == '' ) || ( intval($val2) != (intval($val0) + intval($val1)) ) ) {
                    // Die and return error 403 Forbidden
                    wp_die( 'Bye Bye, SPAMBOT!', '403 Forbidden', array( 'response' => 403 ) );
                }
            }

    hacı verdiğin kodu ekledim, header sağa, sidebar sola, mesajlar kayboldu
  • 24-08-2010, 20:58:39
    #6
    css nizde sorun vardır

    editli temamı kullanıyorsunuz?

  • 24-08-2010, 21:00:37
    #7
    Googital.com
    Evet editledim az biraz, siteyi Pm attim hocam.
  • 24-08-2010, 23:00:10
    #8
    functions.php ye ekledikten sonra kodu nasıl yorum formuna çağıracağım