Page 1 of 1

Tracking user IP address?

Posted: Fri Jul 21, 2006 11:54 am
by fatman
This is basic, I'm sure

I want to display the viewers IP on a PHP page, how do I do this?

Posted: Fri Jul 21, 2006 12:00 pm
by Luke
HAHA Your username is priceless!

$_SERVER['REMOTE_ADDR'] - but be warned... it's not reliable read about it at php.net (I think they have user comments about it)

Posted: Fri Jul 21, 2006 12:00 pm
by feyd
search through the $_SERVER variables, you may find something of interest in there.

No Luck!

Posted: Fri Jul 21, 2006 4:41 pm
by fatman
Nope, I'm afraid it returns the same IP for any user viewing the page.

Other variations on the REMOTE_ADDR prhapse?

Posted: Fri Jul 21, 2006 4:45 pm
by Luke
uhh... that's how you get the remote address. Like I said it's not that reliable. Two computers can appear to have the same IP, one computer can different IP per page request (AOL I think). IP in no way is reliable whatsoever for tracking users.

Posted: Fri Jul 21, 2006 4:53 pm
by Benjamin
There was a post on here a while back from someone who had a server behind a proxy server, which caused it to always return the same remote IP. That could be another reason why it's not working for you.

It only goes to show....

Posted: Fri Jul 21, 2006 4:59 pm
by fatman
You see, I knew there was a reason I asked you. I know some about a lot, but very little about a lot.

Jokes aside, I'm reading on php.net as you suggested, and I'm learning a lot, slowly.

Its for my index page, so I dont want to use Java in the head (I believe Google likes it better if I dont, I think...)

I have a little script that tells me by email when a page gets hit, or when it has been hit a specified ammount of times (a little like hitslink) I know I can do this inGoogle analytics, but I dont want to wait untill 2morrow. What I want to do is to see who comes on to my site and what pages they view, real time.

How else could I possibly track it?

Posted: Fri Jul 21, 2006 5:17 pm
by Luke
php sessions

OK fine

Posted: Fri Jul 21, 2006 5:28 pm
by fatman
I knew you were going to swear at me sometime. OK I'll go away and read some more.

I have to admit that I dont know sessions, but I will go and look it up.

Incidently, another thing... Something went seriously wrong with my DB about 2 weeks ago, and I had to change my username and password. I kept exeeding the "MAX_USERS" for my username, and it got so bad that my site couldn't show data at all. I have an enemy who happens to be an IP providor. (Not mine) Can someone like that actually cause something like that if they wanted to? And, if he did, could I find out?

Just wondering