In article <3fe81e2c.3140813@News.CIS.DFN.DE>,
NOSPAM@hotmail.com (Donna
Hawkins) writes:
[color=blue]
>
>Thanks McKirahan, Richard, and Hikks
>
>I apologise for not explaining it properly.
>
>The user clicks on a link and then this link goes to a redirect page
>with the URL passed as a variable such as:
>
>
http://www.mydomain.com/redirect.php...ariableurl.com
>
>I then want to record in a mysql database that there has been a click
>for this 'www.variableurl.com'
>
>Then I want to redirect to the variable "url".
>
>Hikks is quite right about the php redirect:
>
>-------------------------------------------------------------------------[/color]
------------------------[color=blue]
>//give the variable $redirectURL the value of the passed "url" (i know
>you can just use '$url' but just showing what is happening)
>
>$redirectURL=$url
>
>// then redirect to the variable
>
> header("Location:$redirectURL");
>
>-------------------------------------------------------------------------[/color]
-------------------------[color=blue]
>I wanted to know the javascript for a few reasons such as:
>
>1/ whether javascript stamps the click as coming from 'redirect.php'
>(the php redirect stamps it with the page that the user originally
>clicked on and not the redirecting page)[/color]
alert(document.referrer)
in the final page might tell you. document.referrer only holds a value if the
page was reached via a link from another page. A simple test should be able to
tell you. I don't have PHP running at the moment to make the test pages to find
out :(
[color=blue]
>2/ whether it can be used to hide the links from google[/color]
I think thats the first time I have read about someone wanting to hide links
from google, its usually the other way around :)
[color=blue]
>3/ whether the javascript redirect can be used after there has been
>output (php redirect can only be used if there has been no output).[/color]
No output to the browser, as you know. It can process for days (if need be) as
long as it doesn't output to the browser. Meaning, before you send the location
header, have PHP log the "hit".
<?php
//code here to put the entry in the data basee
header(location.........);
[color=blue]
>I didn't think the javascript would be that difficult and, as I said,
>I searched for a while for a solution but there was none there.[/color]
The closest javascript will have for a header(location redirect would be
location.replace which replaces the current page in the history with the new
page. Thus when the back button is clicked, they go back to the first page, and
skip the redirect page. Clicking the Forward button from there takes them back
to the redirected page, not the one doing the redirecting.
[color=blue]
>Anyway thanks again, I learnt something just by studying your answers.[/color]
Hope this helps.
--
Randy