Getting the first two octects of an IP address...
Hello, I was wondering how do you get the first two octets of an IP address?
Code:
111.111.XXX.XXX Does that mean I have to do get_user_up(id,clientIP,7,1)? |
Re: Getting the first two octects of an IP address...
If you want the 7 first characters, just do that :
new clientIP[8]; get_user_ip(id, clientIP, 7, 1); |
Re: Getting the first two octects of an IP address...
If you want both separated:
Code:
|
Re: Getting the first two octects of an IP address...
Well I have this...
Code:
And as you can see on the 10.16. if someone connects with 210.16, it returns true as well. Since 10.16 is contained in 210.16. |
Re: Getting the first two octects of an IP address...
PHP Code:
|
Re: Getting the first two octects of an IP address...
I didn't quite get it Yami sorry. I apologize.
|
Re: Getting the first two octects of an IP address...
newip will contain the first two octets only, no matter if it is 8.69 or 123.238
|
Re: Getting the first two octects of an IP address...
Or what about:
Code:
|
Re: Getting the first two octects of an IP address...
Ok let's say that 210.16 was client that connected.
But how do I make sure that when I compare 210.16 to 10.16 it wouldn't think that it's the same IP. Because that's what's happening. |
Re: Getting the first two octects of an IP address...
Depending on which script you use,
Mine (you will have to remove the last '.' in the list of IPs or add another '.' to the end of newip): PHP Code:
|
| All times are GMT -4. The time now is 01:45. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.