Changeset 1603

Show
Ignore:
Timestamp:
09/05/04 01:50:39 (4 years ago)
Author:
saxmatt
Message:

Track and check user agent for comments.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-comments-post.php

    r1405 r1603  
    1616    $_POST   = add_magic_quotes($_POST); 
    1717    $_COOKIE = add_magic_quotes($_COOKIE); 
     18    $_SERVER = add_magic_quotes($_SERVER); 
    1819} 
    1920 
     
    2829if (strlen($url) < 7) 
    2930    $url = ''; 
     31 
     32$user_agent = $_SERVER['HTTP_USER_AGENT']; 
    3033 
    3134$comment = trim($_POST['comment']); 
     
    6366// If we've made it this far, let's post. 
    6467 
    65 if(check_comment($author, $email, $url, $comment, $user_ip)) { 
     68if( check_comment($author, $email, $url, $comment, $user_ip, $user_agent) ) { 
    6669    $approved = 1; 
    6770} else { 
     
    7073 
    7174$wpdb->query("INSERT INTO $wpdb->comments  
    72 (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved)  
     75(comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved, comment_agent)  
    7376VALUES  
    74 ('$comment_post_ID', '$author', '$email', '$url', '$user_ip', '$now', '$now_gmt', '$comment', '$approved'
     77('$comment_post_ID', '$author', '$email', '$url', '$user_ip', '$now', '$now_gmt', '$comment', '$approved', '$user_agent'
    7578"); 
    7679 
  • trunk/wp-includes/functions.php

    r1601 r1603  
    14941494        if ( preg_match($pattern, $comment) ) return false; 
    14951495        if ( preg_match($pattern, $user_ip) ) return false; 
     1496        if ( preg_match($pattern, $useg_agent) ) return false; 
    14961497    } 
    14971498 
  • trunk/wp-trackback.php

    r1599 r1603  
    5555    $now_gmt = current_time('mysql', 1); 
    5656 
     57    $user_agent = addslashes($_SERVER['HTTP_USER_AGENT']); 
     58 
    5759    $comment = convert_chars($comment); 
    5860    $comment = format_to_post($comment); 
     
    6769    $moderation_notify = get_settings('moderation_notify'); 
    6870 
    69     if(check_comment($author, $email, $url, $comment, $user_ip)) { 
     71    if(check_comment($author, $email, $url, $comment, $user_ip, $user_agent)) { 
    7072        $approved = 1; 
    7173    } else { 
     
    7476 
    7577    $result = $wpdb->query("INSERT INTO $wpdb->comments  
    76     (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved
     78    (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved, comment_agent
    7779    VALUES  
    78     ('$comment_post_ID', '$author', '$email', '$tb_url', '$user_ip', '$now', '$now_gmt', '$comment', '$approved'
     80    ('$comment_post_ID', '$author', '$email', '$tb_url', '$user_ip', '$now', '$now_gmt', '$comment', '$approved', '$user_agent'
    7981    "); 
    8082