View Full Version : Simple Question About Checking Whether a user click on a link or not

09-22-2007, 05:51 PM
Yes, I'm making a website and what I need to know is about a simple script that would see if a user clicked on 5 or more affiliate banners/ads given. Once the user has clicked 5 or more, a button would appear, and once you click on that, an email would be sent to me.
Anyone know?

Len Whistler
09-23-2007, 02:33 AM
I would direct all banner clicks to a second file,which then redirects to the advertiser. Use sessions or cookies to keep track of how many times advertiser.php loads during their visit. The syntax below may be incorrect, but it should give you a starting point.

"<a href=\"advertiser.php?id=01\"></a>";
"<a href=\"advertiser.php?id=02\"></a>";
"<a href=\"advertiser.php?id=03\"></a>";



if ($_GET['id'] = 01) {
header ("Location: http://www.advertiser_one.com");
if ($_GET['id'] = 02) {
header ("Location: http://www.advertiser_two.com");
if ($_GET['id'] = 03) {
header ("Location: http://www.advertiser_three.com");

09-23-2007, 02:58 AM
I agree with using sessins but, after the five visits have been reached maybe you could use a conditional to run a sub, whihc emails you. That should save the errors from poeple who don't want to click.


09-23-2007, 04:21 AM
Thank you, Len Whistler. That helped!!

09-24-2007, 03:14 AM
But wait, I'm going to be using at least 100 ads they have to choose to click on (they only have to click on 3). so how would I make a special page for each and every one advertisement?

Len Whistler
09-24-2007, 04:22 AM
I assume these "affiliate banners/ads" are external URL links? Or are they internal links? Or do you just want to count the clicks on banners that doesn't take you anywhere?

Keeping track of 100 different clicks will be a big coding job, I recommend PHP and a MySQL database.