Log in

View Full Version : Conditional to check IP address?


x3sphere
10-17-2006, 06:30 PM
Is there one?

Reeve of shinra
10-17-2006, 09:16 PM
what do you want to do? you can enable usergroups to view IP addresses by default

Adrian Schneider
10-17-2006, 09:21 PM
If you want the IP address of the user currently viewing, it's $_SERVER['REMOTE_ADDR'] or the constant IPADDRESS. (you really have to tell us more to get any help lol)

x3sphere
10-17-2006, 10:45 PM
If you want the IP address of the user currently viewing, it's $_SERVER['REMOTE_ADDR'] or the constant IPADDRESS. (you really have to tell us more to get any help lol)

Yes I know that. I just wondered if there was a vbulletin variable for it. As I can't seem to include php code into the default vb templates.

php include didn't work so I tried this

<if condition="$_SERVER['REMOTE_ADDR']==myiphere">showthis<else />showthis2</if>

However, that resulted in an error :/

Paul M
10-17-2006, 10:51 PM
Did you enclose your ip in (single) quotes ?

x3sphere
10-17-2006, 10:54 PM
Did you enclose your ip in (single) quotes ?

Ah, that works :) thanks man

Here is the working code if anyone wants to do something similar

<if condition="$_SERVER['REMOTE_ADDR'] == 'myiphere'">showthis<else />showthis2</if>