Make WordPress Core

Changeset 3990


Ignore:
Timestamp:
07/06/2006 12:04:24 AM (18 years ago)
Author:
matt
Message:

Clean up how we address IP addresses throughout the code

Location:
trunk/wp-includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/comment.php

    r3985 r3990  
    322322
    323323    if ( ! isset($comment_author_IP) )
    324         $comment_author_IP = $_SERVER['REMOTE_ADDR'];
     324        $comment_author_IP = preg_replace( '/[^0-9., ]/', '',$_SERVER['REMOTE_ADDR'] );
    325325    if ( ! isset($comment_date) )
    326326        $comment_date = current_time('mysql');
     
    366366    $commentdata['user_ID']         = (int) $commentdata['user_ID'];
    367367
    368     $commentdata['comment_author_IP'] = $_SERVER['REMOTE_ADDR'];
     368    $commentdata['comment_author_IP'] = preg_replace( '/[^0-9., ]/', '',$_SERVER['REMOTE_ADDR'] );
    369369    $commentdata['comment_agent']     = $_SERVER['HTTP_USER_AGENT'];
    370370
  • trunk/wp-includes/functions.php

    r3979 r3990  
    10131013function wp_proxy_check($ipnum) {
    10141014    if ( get_option('open_proxy_check') && isset($ipnum) ) {
     1015        $ipnum = preg_replace( '/([0-9]{1,3})\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}).*/', '$1', $ipnum );
    10151016        $rev_ip = implode( '.', array_reverse( explode( '.', $ipnum ) ) );
    10161017        $lookup = $rev_ip . '.sbl-xbl.spamhaus.org.';
  • trunk/wp-includes/vars.php

    r3910 r3990  
    3434$is_apache = ( strstr($_SERVER['SERVER_SOFTWARE'], 'Apache') || strstr($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') ) ? 1 : 0;
    3535$is_IIS = strstr($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') ? 1 : 0;
    36 
    37 // On OS X Server, $_SERVER['REMOTE_ADDR'] is the server's address. Workaround this
    38 // by using $_SERVER['HTTP_PC_REMOTE_ADDR'], which *is* the remote address.
    39 if ( isset($_SERVER['HTTP_PC_REMOTE_ADDR']) )
    40     $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_PC_REMOTE_ADDR'];
    4136
    4237// if the config file does not provide the smilies array, let's define it here
Note: See TracChangeset for help on using the changeset viewer.