www.webdeveloper.com
Results 1 to 8 of 8

Thread: Link Counting

  1. #1
    Join Date
    Feb 2006
    Location
    Ontario, CA
    Posts
    199

    Link Counting

    My question is: Can someone help me with a counter that can be used to count how many times a link is activated. I use Andale counters for page counting, but I need a link counter.

    INTERESTING INFO FOR MEN (Ladies you can help your man understand how important this is)

    What is excitement. It's exciting when you find out you have prostate cancer and have it cured in 1 treatment. And, no cancer now for over 9 months.

    Men, get your blood tested (called PSA) for prostate cancer each year. There are no symptoms. Guess what, approximately 50% of all men get it and you really don't want it. You have to catch it early.

    Go to our site and use keyword "Prostate Cancer"
    Last edited by Launchnet; 03-30-2006 at 10:54 AM.

  2. #2
    Join Date
    Mar 2006
    Posts
    40

  3. #3
    Join Date
    Mar 2006
    Posts
    40

  4. #4
    Join Date
    Feb 2006
    Location
    Ontario, CA
    Posts
    199

    Hey Comtrad

    I have many links out to various other websites, and I give each link credit to the company I link to. I don't steal credits or imply that they may be part of my site.

    As an example, let's say that I have 10 pages with miscellaneous links on each page.

    What I need is a counter that tells me how many hits I have on each individual link where I want to assign a link. The link count can even be next to the link if necessary.

    Thanks for the picture you sent me. In looking at it, I doubt it will do what I am looking for.

    Before I do all the work of researching this, I think you can probably give me the answer off the top of your head.

    Thanks
    Matt

  5. #5
    Join Date
    Apr 2005
    Location
    Bathurst, NSW, Australia
    Posts
    3,357
    I think PHP would be your answer. Relocated thread to PHP Forum.

  6. #6
    Join Date
    Feb 2005
    Location
    Tauranga
    Posts
    2,062
    give each link an id.

    then refer each link to a counter page on your site. and add the id into a database, then at the end of the month just count the entries and reset the databse or something simalar. then redirect them to that site.

    for instance
    Code:
    <a href="counter.php?id=http://www.domain.com">http://www.domain.com</a>
    and on counter.php
    PHP Code:
    <?php
    $url 
    $_GET['id'];
    $date date(dMYh:m:s);
    $q "INSERT INTO counter (`date`) values ('$date') WHERE url = '".$url."' ";
    $s mysql_query($q);

    header("Location : ".$url);
    ?>

  7. #7
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,972
    Sheldons solution is great if you're already into databases, but if you want a simpler solution (but the same idea) then you can do it with just a text file.
    code:
    <?php
    $url = $_GET['id'];
    $date = date(dMYh:m:s);
    // The 'a' in fopen(); means to open the file
    // for writing only and to place the pointer
    // at the end of the file.
    $log = fopen('outlog.txt',a);
    fwrite($log,"\n$url @ $date");
    fclose($log);

    header("Location:$url");
    ?>

    Although you may want to control whether you let your visitors read that file.

  8. #8
    Join Date
    May 2013
    Location
    Surendranagar Gujarat India
    Posts
    55
    <html>
    <body>

    <form action="upload_file.php" method="post"
    enctype="multipart/form-data">
    <label for="file">Filename:</label>
    <input type="file" name="file" id="file"><br>
    <input type="submit" name="submit" value="Submit">
    </form>

    </body>
    </html>

    <?php
    if ($_FILES["file"]["error"] > 0)
    {
    echo "Error: " . $_FILES["file"]["error"] . "<br>";
    }
    else
    {
    echo "Upload: " . $_FILES["file"]["name"] . "<br>";
    echo "Type: " . $_FILES["file"]["type"] . "<br>";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
    echo "Stored in: " . $_FILES["file"]["tmp_name"];
    }
    ?>

    Kishor Makwana
    Software Engineer
    Insight Softech
    www.insightsoftech.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles