Re: where do they go? How can I gather Click info in PHP



Guenther Schmidt wrote:
> Windandwaves
>
> this is acutally rather easy.
>
> the link that people click on should be something like:
>
> <a href="/redirect.php?destinationURL=www.cnn.com">www.cnn.com</a>
>
>
> in redirect.php
>
> you would code whatever is necessary to write the destination URL
> into the database and then redirect the visitor to the intended
> destination by doing:
> header ('Location: '.$_REQUEST['destinationURL']);
>
> that's all.
>
> If you want to find out *where they come from* there is a variable
> called HTTP_REFER or something like that. Study the output of
> phpinfo(); to find the exact name.
> There is a tutorial/article for exactly this called "where they went,
> where they came from" on http://www.phpbuilder.com
>
> Good luck!
>
> Günther


Here is what I did:

//link to database

$bot = browser_detection("type");
if(strlen($p) == 3){
$pageowner= $p;
}
if($h == 1) {
$httper = "http://".$pageownerwebsite;
}
elseif($h == 2) {
$httper = "http://".$pageownersecondsite;
}
else {
$httper = "http://www.myurl.co.nz/404.php";;
}
$sqllog = 'INSERT INTO `LOG` ( `field1` , `field2` , `field3`, `field4` )
VALUES (NOW() , "'.$pageowner.'", "clicked","'.$httper.' ('.$bot.')" );';
$logger = mysql_query($sqllog);
$locationer = $httper;
header("Location: $locationer");

?>

It seems to be working well.


.



Relevant Pages

  • Re: where do they go? How can I gather Click info in PHP
    ... Guenther Schmidt wrote: ... > you would code whatever is necessary to write the destination URL ... > windandwaves wrote: ... >> using PHP. ...
    (comp.lang.php)
  • Re: hitting the limits
    ... windandwaves wrote: ... I know what efficient code is, but there are just so many ... Even making changes tot the php.ini could be huge. ... Having a database doesn't make a differnce. ...
    (comp.lang.php)