Redirecting from hyperlinks

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Berbbrown
Forum Newbie
Posts: 2
Joined: Wed Mar 15, 2006 9:20 am

Redirecting from hyperlinks

Post by Berbbrown »

I would like to record to a database when a hyperlink is clicked on my website and have a couple of questions.

1. What is easiest and most effective way to do this?
2. How can I ensure that the website where the link points to will see that some of their traffic originates from my site?

Can anyone help please?

Many thanks

B
dave_c00
Forum Commoner
Posts: 37
Joined: Wed May 28, 2003 6:08 am

Re: Redirecting from hyperlinks

Post by dave_c00 »

Berbbrown wrote:I would like to record to a database when a hyperlink is clicked on my website and have a couple of questions.

1. What is easiest and most effective way to do this?
2. How can I ensure that the website where the link points to will see that some of their traffic originates from my site?

Can anyone help please?

Many thanks

B
You can create a .php page that is run from every link on your site with a ?url=http://www.google.co.uk on the end.

When the page is opened it does the relevant query to save the data to a table and then performs a redirect to the $_GET['url'].

The linked website will still see the $_HTTP['REFERER'] as being that new .php page on your site.
Post Reply