shavenlunatic
MIS
Hey, I decided to dump all referral URLs into a database just so I can view exactly what's happening easilly, the posting of the data is working fine and there's plenty of data in there. I didn't want the empty HTTP_REFERER visits to be posted in there, nor did i want to post the ones which were generated internally, so I tried to cut them out and wrap the mysql statement in an if statement to check for these, but none seem to work. I also tried checking for the length of the $referral string for being greater than 1, yet it still posts blank entries.
I've posted the code below to give an idea of what I've been doing, but I've had a play about with a few different methods and none have worked. I expect that dumping the HTTP_REFERER into a variable doesn't treat it like a normal text string, but I'm not sure what I need to do to convert it. I managed to find a guide on a site which was doing almost exactly what I wanted to do, yet this still posted the blank URL entries.
You help will be appreciated
________
clueless
I've posted the code below to give an idea of what I've been doing, but I've had a play about with a few different methods and none have worked. I expect that dumping the HTTP_REFERER into a variable doesn't treat it like a normal text string, but I'm not sure what I need to do to convert it. I managed to find a guide on a site which was doing almost exactly what I wanted to do, yet this still posted the blank URL entries.
Code:
$ip=$_SERVER['REMOTE_ADDR'];
if( isset($_SERVER['HTTP_REFERER']) AND trim($_SERVER['HTTP_REFERER']) != '' )
{
$referral = $_SERVER['HTTP_REFERER'];
if(stristr($referral, '[URL unfurl="true"]http://www.iwontwhoremysitehere.net')[/URL] === FALSE){
mysql_query ("INSERT INTO `db`.`table` (RefIP, RefURL) VALUES ('".$ip."', '".$referral."')");
}
}
You help will be appreciated
________
clueless