I use the code below to get our VPN IP address from the PHP page and that works great but to make it easier. I would like to create another label on our skin that says which VPN site they are connected to
eg
192.168.41.* is England
192.168.51.* is USA
If they are on a 172.16 to 20 range then say O2 connected
If 172.120 or 130.* then they are on a satellite/remote office connection
I know you can have more than 1 substitute but I have to know the full IP address. Is there a way to do this ?
; Get the IP address
[MeasureNetwork]
Measure=Plugin
Plugin=WebParser
URL=http://infrastructure.****/ip.php
UpdateRate=14400
RegExp=(?siU)^(.*)$
StringIndex=1
Substitute="":"Not Connected to Network"
This will, check the third section of the IP address and use IfConditions to set the location or whatever you call it. If it depends on more than that, then more processing would be required.
nytram wrote: ↑September 10th, 2021, 11:18 am
Sorry, I also found that %1 search was pulling 16 from the ip 168 on part 2 of the IP and it should have ignored it as its 168.
I would have thought quotes would have fixed that.
Is there a way for it to search and substitute the correct number ie 168 and not 16 ?
Thanks again
Martyn
Sorry to barge in here... all this sounds overly complicated. It should be fairly simple to do exactly what you are asking, and you shouldn't need more than a single measure to do it. Can you post a simple table of the IP addresses and the locations you want to see? (Don't try to chop the address into parts, that's just going to overcomplicate things.)
These are the IP Ranges that we use and I want to substitute the office location or Mobile Carrier
eg if IP starts with 172.16 or 172.18 then Id like to substitute with Mobile Carrier Connection or 192.168.41 is Leeds VPN Connection and 192.168.51 is Manchester VPN Connection
nytram wrote: ↑September 10th, 2021, 12:46 pm
Hi no problems barging in
These are the IP Ranges that we use and I want to substitute the office location or Mobile Carrier
eg if IP starts with 172.16 or 172.18 then Id like to substitute with Mobile Carrier Connection or 192.168.41 is Leeds VPN Connection and 192.168.51 is Manchester VPN Connection