Page 1 of 1
Visitor's IP Address ?? [SOLVED]
Posted: Sun Jan 25, 2009 8:55 pm
by pamelina
Hello,
I'm trying to modify my page to show visitor's IP Address ...
GeoHostIP plugin isn't O.K. for me ... is there an alternative / trick
what to input in a website so I can retrieve the IP and style it in CSS?
Re: Visitor's IP Address ??
Posted: Sun Jan 25, 2009 8:57 pm
by RonnyK
The module Statistics has the parameter....
visitorip : show the IP of the current visitor
Ronny
Re: Visitor's IP Address ??
Posted: Sun Jan 25, 2009 8:59 pm
by calguy1000
{$smarty.server.REMOTE_ADDR} ?? or something like that.
Re: Visitor's IP Address ??
Posted: Sun Jan 25, 2009 9:09 pm
by SimonSchaufi
can confirm that:
{capture name=some_content assign=popText}
The server is {$smarty.server.SERVER_NAME|upper} at {$smarty.server.SERVER_ADDR}
Your ip is {$smarty.server.REMOTE_ADDR}.
{/capture}
help
http://www.smarty.net/manual/en/languag ... ctions.php at the bottom
Re: Visitor's IP Address ??
Posted: Sun Jan 25, 2009 9:15 pm
by pamelina
I have inserted both:
{Statistics visitorip} as stated in module help
and
{$smarty.server.REMOTE_ADDR}
No ... go, it's not working ....
I wish to put Visitor's Ip address to front page so visitor can see his/hers IP.
Re: Visitor's IP Address ??
Posted: Sun Jan 25, 2009 9:19 pm
by SimonSchaufi
more details please! where did you put it? if you put it in the template, it works for example
Re: Visitor's IP Address ??
Posted: Sun Jan 25, 2009 9:25 pm
by nhaack
I have a little code snippet that might help (actually not my own code, taken from the geo_ip module - so credits belong to respective author):
Code: Select all
function get_ip() {
if (isset($_SERVER['HTTP_CLIENT_IP'])) {
$ip = stripslashes($_SERVER['HTTP_CLIENT_IP']);
} else {
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = stripslashes($_SERVER['HTTP_X_FORWARDED_FOR']);
} else {
$ip = stripslashes($_SERVER['REMOTE_ADDR']);
}
}
return $ip;
}
Best
Nils
Re: Visitor's IP Address ??
Posted: Sun Jan 25, 2009 9:29 pm
by pamelina
To all of you BIG Thanks for pointing me to the right direction ....
Special thanks to Simon Schaufi, I solved the problem, did exactly what link stated ...
Pamelina