Visitor's IP Address ?? [SOLVED]

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
pamelina
Forum Members
Forum Members
Posts: 69
Joined: Mon Nov 05, 2007 4:05 pm

Visitor's IP Address ?? [SOLVED]

Post 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?
Last edited by pamelina on Sun Jan 25, 2009 9:33 pm, edited 1 time in total.
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: Visitor's IP Address ??

Post by RonnyK »

The module Statistics has the parameter....
visitorip : show the IP of the current visitor
Ronny
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Visitor's IP Address ??

Post by calguy1000 »

{$smarty.server.REMOTE_ADDR} ?? or something like that.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
SimonSchaufi

Re: Visitor's IP Address ??

Post 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
pamelina
Forum Members
Forum Members
Posts: 69
Joined: Mon Nov 05, 2007 4:05 pm

Re: Visitor's IP Address ??

Post 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.
SimonSchaufi

Re: Visitor's IP Address ??

Post by SimonSchaufi »

more details please! where did you put it? if you put it in the template, it works for example
nhaack

Re: Visitor's IP Address ??

Post 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
pamelina
Forum Members
Forum Members
Posts: 69
Joined: Mon Nov 05, 2007 4:05 pm

Re: Visitor's IP Address ??

Post 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
Post Reply

Return to “Tips and Tricks”