I have been trying to figure how to implement a "hit counter" for each of my websites in my css gallery, and display the total number of times a person has visited that link (or image).

Could anyone lead me in the right direction, so I could get started on this...

Thanks!

Do you have access to any server-side scripting(PHP, ASP, JSP) etc.?

If so you can configure a script to count all the times the image is viewed.

Else you may need to use a thrid party site to count it for you. Others with web servers may do this for you usually free of charge, of course if you ask nicely. There are many popular sites on the web that offer this service for free.

If you do have access to a server-side script then I maybe able to help you. I only have knowledge in PHP.

Do you have access to any server-side scripting(PHP, ASP, JSP) etc.?

If so you can configure a script to count all the times the image is viewed.

Else you may need to use a thrid party site to count it for you. Others with web servers may do this for you usually free of charge, of course if you ask nicely. There are many popular sites on the web that offer this service for free.

If you do have access to a server-side script then I maybe able to help you. I only have knowledge in PHP.

Didn't realise this was in the PHP forum. Ok the PHP code would go a little like this.

<?php
$filePath = "PATH TO TEXT FILE THAT WILL HOLD VISITS";
$current = file_get_contents( $filePath );
$current = $current + 1;
$fileHandle = fopen( $filePath , "w" );
fwrite( $fileHandle , $current );
fclose( $fileHandle );

echo "Visits: ".$current."<br />";
?>

Ok the only issue is that you will only be able to use this if each image has its own directory. The next thing you could do is implement JavaScript to submit the information via AJAX to the PHP document that controls the text files. Or you could even use databases.

Please give me more on how your gallery works.

Hi, it's a pretty straightforward gallery http://www.siiimple.com/

Would each image have to have it's own folder, therefore it's own directory?

I guess the idea is to count the number of times a visitor clicks on an image - to visit that particular site. I would display the total just below the image.

Thanks very much for your help. I'm learning php (albeit, slowly).

Have a landing page that users go to before being redirected to a site. If every image has an id in a database, then you can just change all the links in your page to something like click.php?id=[image id]

on click.php you update the database with the new click and redirect to the website. It would be simple and wouldn't require a direct edit of the code.

Hi, it's a pretty straightforward gallery http://www.siiimple.com/

Would each image have to have it's own folder, therefore it's own directory?

I guess the idea is to count the number of times a visitor clicks on an image - to visit that particular site. I would display the total just below the image.

Thanks very much for your help. I'm learning php (albeit, slowly).

Unless you do something like taking the filename of the image and removing the extension (.jpg, .png etc.) and peplacing it with a .txt version. This would mean for every image you have you will have the same amount of text files. I have to say it would be allot easier implementing some sort of PHP/MySql/AJAX/JavaScript system.