Make WordPress Core


Ignore:
Timestamp:
11/15/2004 06:20:28 AM (21 years ago)
Author:
rboren
Message:

Refuse comments for post IDs that do not exist.

File:
1 edited

Legend:

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

    r1781 r1854  
    3636$user_ip = $_SERVER['REMOTE_ADDR'];
    3737
    38 if ( 'closed' ==  $wpdb->get_var("SELECT comment_status FROM $wpdb->posts WHERE ID = '$comment_post_ID'") )
     38$post_status = $wpdb->get_var("SELECT comment_status FROM $wpdb->posts WHERE ID = '$comment_post_ID'");
     39
     40if ( empty($post_status) ) {
     41    // Post does not exist.  Someone is trolling.  Die silently.
     42    // (Perhaps offer pluggable rebukes? Long delays, etc.)
     43    die();
     44} else if ( 'closed' ==  $post_status ) {
    3945    die( __('Sorry, comments are closed for this item.') );
     46}
    4047
    4148if ( get_settings('require_name_email') && ('' == $email || '' == $author) )
Note: See TracChangeset for help on using the changeset viewer.