Raised This Month: $51 Target: $400
 12% 

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
0920357689
Senior Member
Join Date: Apr 2008
Old 07-29-2012 , 09:43   Re: hot to check LAN ip
Reply With Quote #9

Quote:
Originally Posted by fysiks View Post
What language are you doing this in? It doesn't really sound like an AMX Mod X thing.
PHP Code:
        new IpPort[32];
    
get_user_ip(0IpPort311);
    
    new 
isubent[4];
    for(
i=0i<4i++)
    {
        new 
Temp[32];
        
strtok(IpPortTemp31IpPort31'.');
        
subent[i] = str_to_num(Temp);
    }
    
server_print("%d %d %d %d",subent[0],subent[1],subent[2],subent[3]); 
i test my core is work
0920357689 is offline
Backstabnoob
Veteran Member
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 07-29-2012 , 10:30   Re: hot to check LAN ip
Reply With Quote #10

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.
__________________
Currently busy working on a very large scale anime database project.

Last edited by Backstabnoob; 07-29-2012 at 10:30.
Backstabnoob 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 02:12.


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