View Single Post
Old 09-02-2011, 06:01 PM  
robber
Web Developer
 
Industry Role:
Join Date: Jan 2011
Location: UK
Posts: 264
hmm, what controls where the clicks are going, if it is you then all you need to do is have a file like an out.php that just logs what was clicked and then redirects the user onto the site (this is how my site deals with the thumbnail clicks), except I don't track them at the moment.

It would be simple enough to do your link could be something like:
Code:
<a href="out.php?page=#Your Link#"><img src="#image source" ..... ></a>
Then your out.php would just need to be something like: (This is not how mine works, just to tell you)

Code:
<?php

## Connect to DB ##
mysql_connect(#host#,#user#,#pass#);
mysql_select_db(#db name#);

## Do the logging then redirecting ##

$link = mysql_real_escape_string($_GET['page']); #this cleans your code
mysql_query("update linktrack set count=count+1 where link='".$link."'");
header("location: ".$link);
exit();
?>
I'm sure they would be a cleaner more efficient way of doing this I'm just not sure what it is.

If you have any issues with this or need help customising it to fit your system please free to either reply back here or to drop me an e-mail on [email protected] (replace the 0's for o's)

Kind Regards

Rob

Last edited by robber; 09-02-2011 at 06:05 PM.. Reason: Changing mysql query to be just one rather than two
robber is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook