Jump to content


Visitor info


3 replies to this topic

#1 unlØgik

    Young Padawan

  • Members
  • Pip
  • 51 posts
  • Location:Portugal

Posted 23 November 2005 - 12:12 PM

Hi

im currently building my website i change from a blog to a website so i can learn some php.

I want to include a stats that say something like this :

Your ip is : xxx.xxx.xx..xx
Your from :
You just made the xxx click on this site and you are using firefox ( good 4 you! ) .

The "made the xxx click on this forum" i got cover with a click counter that uses flat file..

So i need a php command that says witch browser user is using , and the country he is.

Also im having a problem with the ip show command

<?
echo "Your IP is : $REMOTE_ADDR";
?>

I guess people behind a firewall or a router, the ip wont show :(

Thanks in advance :ph34r:

#2 fiv3isaliv3

    Young Padawan

  • Members
  • Pip
  • 258 posts
  • Gender:Male

Posted 23 November 2005 - 01:33 PM

$browser = $_SERVER['HTTP_USER_AGENT'];
$ip = $_SERVER['REMOTE_ADDR'];

those are pretty easy to understand. as far as telling a visitor where they are from... that is a bit more complex as php can't determine a location from an ip. the only way to actually determine a location is to either use third party applications or compare the ip against a database. there are a few sites that offer rather large databases of ip locations for free... but i can't remember any of them off the top of my head. just search google... oh and if you decide to go that route it isn't easy as you'll most likely have to convert the database.

i wrote a script awhile back that uses a database i found... but the data is almost a year old so it isn't as accurate anymore. you can see it here: http://www.zealivity...php?page=locate ...

Edited by zealivity5, 23 November 2005 - 01:52 PM.


#3 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 23 November 2005 - 02:41 PM

In regards to viewing the IP's, read:
http://php.net/register_globals
http://php.net/manua...etenv.php#53599

As for everything else, search through here: http://www.pixel2life.com/tutorials/PHP_Co...tion_and_Stats/

#4 unlØgik

    Young Padawan

  • Members
  • Pip
  • 51 posts
  • Location:Portugal

Posted 23 November 2005 - 05:20 PM

Thanks both for ur replys , i made a mistake, caming here 1st insted to the tutorials database. sorry :)


ivé managed to do all the thing that i wanted....only a gallery missing :D gona keep looking..





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users