Jump to content

$HTTP_REFERER


koolgirl

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:

*************************************************
<?php

$dbcnx = @mysql_connect(

'mysql','login','password');

mysql_select_db("MainDB");

$sql = "INSERT INTO UserRecords SET " .

"IP='$REMOTE_ADDR', " .

"BrowserName='$HTTP_USER_AGENT', " .

"Language='$HTTP_ACCEPT_LANGUAGE', " .

"Referer='$HTTP_REFERER', " .

"Date=CURDATE()";

if (mysql_query($sql)) {

echo("");

} 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

Link to comment
Share on other sites

well just so you know, it may be working just fine. from the manual:

'HTTP_REFERER'

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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.