This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

hot to check LAN ip


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
0920357689
Senior Member
Join Date: Apr 2008
Old 07-29-2012 , 02:00   hot to check LAN ip
Reply With Quote #1

10.0.0.0 - 10.255.255.255
172.16.0.0 - 172.31.255.255
192.168.0.0 -192.168.255.255


how to check contain in list?
0920357689 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-29-2012 , 02:01   Re: hot to check LAN ip
Reply With Quote #2

Why do you need to do such a thing? Also, have you tried searching?
__________________
fysiks is offline
0920357689
Senior Member
Join Date: Apr 2008
Old 07-29-2012 , 02:04   Re: hot to check LAN ip
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
Why do you need to do such a thing? Also, have you tried searching?
I do not know use what keyword
only find "subnet" but find Nothing
0920357689 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-29-2012 , 02:07   Re: hot to check LAN ip
Reply With Quote #4

Quote:
Originally Posted by 0920357689 View Post
I do not know use what keyword
only find "subnet" but find Nothing
Why do you refuse to answer my first question . . . ?
__________________
fysiks is offline
0920357689
Senior Member
Join Date: Apr 2008
Old 07-29-2012 , 02:09   Re: hot to check LAN ip
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
Why do you refuse to answer my first question . . . ?

I'm writing a real-time server list page
now plugins is done
but need to check the server is LAN or not
0920357689 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-29-2012 , 02:12   Re: hot to check LAN ip
Reply With Quote #6

What language are you doing this in? It doesn't really sound like an AMX Mod X thing.
__________________
fysiks is offline
DjOptimuS
Senior Member
Join Date: Jan 2009
Old 07-29-2012 , 06:03   Re: hot to check LAN ip
Reply With Quote #7

If you want to restrict your server only for LAN, use --> sv_lan "1"
DjOptimuS is offline
0920357689
Senior Member
Join Date: Apr 2008
Old 07-29-2012 , 09:01   Re: hot to check LAN ip
Reply With Quote #8

Quote:
Originally Posted by DjOptimuS View Post
If you want to restrict your server only for LAN, use --> sv_lan "1"

server can use

sv_lan = 0
192.168
in my test
0920357689 is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 07-29-2012 , 10:30   Re: hot to check LAN ip
Reply With Quote #9

Try this

PHP Code:
stock ip2long( const ipaddr[ ] )
{
    
    if( 
containiipaddr":" ) != -)
        return 
0
    
    
new parts][ ], parts_num]
    
ExplodeStringparts33ipaddr"." )
    
    for( new 
i4i++ )
        
parts_num] = str_to_numparts] )
    
    
    return ( 
parts_num] * power256) + parts_num] * power256) + parts_num] * power256) + parts_num] )
    
}


// http://forums.alliedmods.net/showpost.php?p=596283&postcount=3
stock ExplodeStringOutput[][], MaxSizeInput[], Delimiter )
{
    new 
Idxstrlen(Input), Len;
    do 
Len += (copycOutput[Idx], SizeInput[Len], Delimiter ));
    while( (
Len l) && (++Idx Max) )
    return 
Idx;

This will convert an IP address into an integer. You can then compare the two ints to see if one is in the other's subnet.

Last edited by Backstabnoob; 07-29-2012 at 10:30.
Backstabnoob is offline
jim_yang
Veteran Member
Join Date: Aug 2006
Old 07-29-2012 , 10:49   Re: hot to check LAN ip
Reply With Quote #10

Better to use << instead of power() function
parts_num[ 0 ] << 24 ...
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:09.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode