PHP Questions Home

Categories

Arrays
Files
Forms
Functions
Images
MySQL
Numbers
Others
Strings
Website


PHP Functions

PHP Functions


More PHP

Top Questions
Ask a Question

How can I find out where a site visitor comes from?


If the user has come to your site or a page on your site by following a link elsewhere, then that page should be made available through this variable:

$_SERVER["HTTP_REFERER"]

So imagine there was a link on http://www.mysite.com to http://www.yoursite.com/index.php and on that page you had:

$detect = $_SERVER["HTTP_REFERER"];
echo "I know where you came from! You clicked on a link from $detect didn't you!";

... then you will be able to tell your user where they came from.

More website PHP Questions

How do I keep my site menu in one file?
How do I send HTTP headers with PHP?
How do I display todays date on my website?
How to find a domain name for an IP address?
How do I find a visitors IP address?