Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums

Go Back   Code Forums > Application and Web Development > PHP

Reply
 
LinkBack Thread Tools Display Modes
Old 09-14-2006, 06:41 PM   #1 (permalink)
ChefFrank
Code Monkey
 
ChefFrank's Avatar
 
Join Date: Mar 2006
Location: Woodbury, CT
Posts: 38
ChefFrank is on a distinguished road
Send a message via Yahoo to ChefFrank
How do I find the user's IP address with PHP

Now that I've learned the difference between a back slash and a forward slash, and got my log routine working, I want to start adding more information to my file.

What PHP functions do I use to gather information about a user, specificaly, the originating IP address or name. I'm trying to track user patterns, and this might be useful in finding out how real people use my site, and I'll also be able to filter out crawlers that seem to access every page on my system.

Your assistance, is once again, appreciated in advance.

Frank
ChefFrank is offline   Reply With Quote
Old 09-14-2006, 09:55 PM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,532
sde is on a distinguished road
make a page named phpinfo.php and put this code in it:
PHP Code:
<?
phpinfo
();
?>
you can see all the info about your php install as well as all the environment variables available to you.

i believe the variable for the end user's ip is: $_SERVER['REMOTE_ADDR']
__________________
Mike
sde is offline   Reply With Quote
Old 09-15-2006, 06:18 AM   #3 (permalink)
ChefFrank
Code Monkey
 
ChefFrank's Avatar
 
Join Date: Mar 2006
Location: Woodbury, CT
Posts: 38
ChefFrank is on a distinguished road
Send a message via Yahoo to ChefFrank
Yep that's it!

I'm amazed at the amount of stuff you can find out about the system in PHP. I looked at the PHPINFO and it ran on for about 3 pages.

I really gotta find a good book on PHP and start working through. I have ideas, but I gotta learn the language first.

Thanks again!
ChefFrank is offline   Reply With Quote
Old 09-15-2006, 06:24 AM   #4 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,532
sde is on a distinguished road
all that info doesn't matter.. i was more talking about the environment variables.. the stuff that starts with _SERVER

everything above the environment variables just basically tells you what modules and versions are installed with PHP.
__________________
Mike
sde is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Switch / Array Help transfield PHP 6 09-20-2006 08:53 AM
Make a search engine for your website with PHP zhisede PHP 3 10-25-2005 08:54 AM
PHP 5.0.4 and 4.3.11 Released sde Code Newbie News 0 04-20-2005 11:56 AM
PHP vs .NET Redline Lounge 1 11-24-2004 07:10 AM
Zope or PHP Hrqls PHP 9 09-02-2003 12:03 AM


All times are GMT -8. The time now is 08:27 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC8 ©2007, Crawlability, Inc.





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting