Jump to content


This topic is now archived and is closed to further replies.



Recommended Posts

Hi again everyone,

I just wanted to start collecting the information about the visitors by myself without depending on 3rd parties to do it for me. So I wrote this:


$dbcnx = @mysql_connect(



$sql = "INSERT INTO UserRecords SET " .


"BrowserName='$HTTP_USER_AGENT', " .

"Language='$HTTP_ACCEPT_LANGUAGE', " .

"Referer='$HTTP_REFERER', " .


if (mysql_query($sql)) {


} else {

echo("<P>Error processing your request: " .

mysql_error() . "</P>");




Everything works fine with the above code and it updates the fields at the database table correctly. The only field that does not get updated is the Referer field. As far as I know $HTTP_REFERER should take care of it. But it doesn't. Can anyone help me solve the problem? And of course if somebody can suggest which other information should I get if this is not enough?
All help would be Very Very much appreciated

Share this post

Link to post
Share on other sites
well just so you know, it may be working just fine. from the manual:


The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.

here is a list of the reserved variables you may wanna look at:

[a href=\"http://us2.php.net/reserved.variables\" target=\"_blank\"]http://us2.php.net/reserved.variables[/a]

Share this post

Link to post
Share on other sites

Thanks again Guru,

I got it now and the link that you gave is exactly what I had been looking for.

Have a nice day!

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.