Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Nov 2005
    Posts
    58
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Simple Question About Checking Whether a user click on a link or not

    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?

  • #2
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    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.

    PHP Code:
    "<a href=\"advertiser.php?id=01\"></a>";
    "<a href=\"advertiser.php?id=02\"></a>";
    "<a href=\"advertiser.php?id=03\"></a>"
    advertiser.php
    PHP Code:
    <?php
    $_GET
    ['id'];

    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");
    }
    ?>
    Last edited by Len Whistler; 09-23-2007 at 01:37 AM.
    Leonard Whistler

  • #3
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    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.

    bazz

  • #4
    New Coder
    Join Date
    Nov 2005
    Posts
    58
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thank you, Len Whistler. That helped!!

  • #5
    New Coder
    Join Date
    Nov 2005
    Posts
    58
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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?

  • #6
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    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.
    Leonard Whistler


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •