Results 1 to 4 of 4
Threaded View
-
24th Sep 2010, 10:43 PM #1
Making IPB IPv6 capable
PHP Code://-----------------------------------------
// IP Address
//-----------------------------------------
if ( ipsRegistry::$settings['xforward_matching'] )
{
foreach( array_reverse( explode( ',', my_getenv('HTTP_X_FORWARDED_FOR') ) ) as $x_f )
{
$x_f = trim($x_f);
if ( preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $x_f ) )
{
$addrs[] = $x_f;
}
}
$addrs[] = my_getenv('HTTP_CLIENT_IP');
$addrs[] = my_getenv('HTTP_X_CLUSTER_CLIENT_IP');
$addrs[] = my_getenv('HTTP_PROXY_USER');
}
$addrs[] = my_getenv('REMOTE_ADDR');
//-----------------------------------------
// Do we have one yet?
//-----------------------------------------
foreach ( $addrs as $ip )
{
if ( $ip )
{
preg_match( "/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/", $ip, $match );
self::instance()->ip_address = $match[1].'.'.$match[2].'.'.$match[3].'.'.$match[4];
if ( self::instance()->ip_address AND self::instance()->ip_address != '...' )
{
break;
}
}
}
//-----------------------------------------
// Make sure we take a valid IP address
//-----------------------------------------
if ( ( ! self::instance()->ip_address OR self::instance()->ip_address == '...' ) AND ! isset( $_SERVER['SHELL'] ) AND $_SERVER['SESSIONNAME'] != 'Console' )
{
print "Could not determine your IP address";
exit();
}
Also I've noticed that IPB stores ip adresses in mysql with type varchar(32) meaning even if that piece of code gets ipv6 capable there are other problems :/NewEraCracker Reviewed by NewEraCracker on . Making IPB IPv6 capable //----------------------------------------- // IP Address //----------------------------------------- if ( ipsRegistry::$settings ) { foreach( array_reverse( explode( ',', my_getenv('HTTP_X_FORWARDED_FOR') ) ) as $x_f ) { $x_f = trim($x_f); Rating: 5Trusted: Dom, l0calh0st, 0ccul7, robert420
Find all threads started by NewEraCracker
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Gamerz.WS - Capable Moderators and Super Mods Recruitment!
By immu in forum Community CooperativeReplies: 4Last Post: 3rd Mar 2012, 09:32 AM -
IPv6-Only Is Becoming Viable
By Daniel in forum News & Current EventsReplies: 0Last Post: 14th Jan 2012, 04:07 AM -
Partner for making a stream / money making site.
By S?nic in forum Community CooperativeReplies: 21Last Post: 6th Jan 2012, 10:39 PM -
How capable is shared hosting?
By Webcs-Peter in forum Hosting DiscussionReplies: 6Last Post: 21st Dec 2011, 04:55 PM -
Want to Hire a Capable Graphics Designer
By jayfella in forum Completed TransactionsReplies: 12Last Post: 31st Oct 2009, 10:28 AM
themaCreator - create posts from...
Version 3.47 released. Open older version (or...