Welcome Guest ( Log In | Register )




                Web Hosting

 
Reply to this topicNew Topic
How To Program A Counter?, counter for clicks on picture
darul0r
post Jan 31 2005, 03:59 PM
Post #1


Member [ Level 1 ]
Group Icon

Group: Members
Posts: 37
Joined: 31-January 05
Member No.: 2,443


hi @ all!
i have a website with many partypics.. and now i want to have a counter! if anybody clicks on a pic, the counter which is placed under everypic should notice this! so for every pic i want a counter, which shows how often it was clicked and shown!

with which scrpting language should i make it?
which is the best for this quest?

thx for help!

greetz darul0r
Go to the top of the page
 
+Quote Post
NilsC
post Jan 31 2005, 04:40 PM
Post #2


To Err Is Human, To Forgive Divine
Group Icon

Group: Members
Posts: 558
Joined: 24-December 04
From: http://www.ultimatekayakfishing.
com/
Member No.: 1,871


Did you take a look at the counters on this webpage. There should be one there that you can use to count pagehits, so if you treat each picture as a page then the count will be accurate.
Hotscripts.com

I have not tried any of the scripts live uet but I have a couple that I'm testing.

Nils
Go to the top of the page
 
+Quote Post
Peg
post Jan 31 2005, 05:54 PM
Post #3


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 16
Joined: 31-January 05
Member No.: 2,449


Yeah. I have made some site counters but never got em working sad.gif
Go to the top of the page
 
+Quote Post
ChronicLoser
post Feb 1 2005, 04:12 AM
Post #4


Premium Member
Group Icon

Group: Members
Posts: 240
Joined: 13-November 04
From: Arizona
Member No.: 1,356


if all else fails, i suggest going here: http://www.digitalpoint.com/tools/counter/

it's a simple counter and doesn't require signing up or anthing. I've tried it for a day and it seemed to work fine. I ended up using my php counter instead, but this one seems to be decent ^_^
Go to the top of the page
 
+Quote Post
wanhafizi
post Feb 1 2005, 05:30 AM
Post #5


Advanced Member
Group Icon

Group: Members
Posts: 145
Joined: 13-December 04
Member No.: 1,734


i suggest you use Singapore web gallery.
goto hotscripts.com, goto the PHP section and search "Singapore". it is the best gallery script i ever used.
Go to the top of the page
 
+Quote Post
Hercco
post Feb 2 2005, 08:47 PM
Post #6


Super Member
Group Icon

Group: Members
Posts: 595
Joined: 4-September 04
Member No.: 228


QUOTE (darul0r @ Jan 31 2005, 05:59 PM)
with which scrpting language should i make it?
which is the best for this quest?
*



Apparently you wish to make the counter yourself and not use a ready made one. That's the right attitude. biggrin.gif

PHP is a good choice for language. You should make a page that is used for viewing a picture. Use a parameter at the end of the URL to identify which image is loaded. So the url to view a picture would be like: yoursite.com/viewpic.php?pic=1

The variable "pic" here can be accessed with $_GET['pic']

Then of course you need to create some kind of system to save the picture data. You could use simple the picture's name in the variable (yoursite.com/viewpic.php?pic=me.jpg) but that would mean that by changing the url you could view any picture inside yoursite. To avoid you could keep list of pictures that are allowed to be viewed there and check it everytime the page is accessed.

Other, and more sophisticated method would be to build a table, a database one if you are familiar with them (if not, it might be worth learning), where you save a unique id (an integer) for each picture. This same table could be used to save the number of time the page is accessed ie. the thumbnail is clicked.

For the actual counting, it's easy as pie. Just load the old value of clicks plus one to it and save/update database.
Go to the top of the page
 
+Quote Post
LeafH
post Apr 2 2007, 02:55 PM
Post #7


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 9
Joined: 2-April 07
From: Taiwan
Member No.: 21,228


counters

1.CGI scripts

http://cgi.resourceindex.com/Programs_and_...ccess_Counters/

2. PHP

http://php.resourceindex.com/Complete_Scri...ccess_Counters/

you can find many interesting stuffs there.
Download the source and may modify them if you know how.

there are so many kinds of programs which can display the count invisibly
or by using text(Text based) or images(Graphical).

Go to the top of the page
 
+Quote Post
Habble
post Jun 19 2007, 05:51 AM
Post #8


Premium Member
Group Icon

Group: [HOSTED]
Posts: 286
Joined: 17-June 07
From: Tasmania
Member No.: 22,699


You should use php with mysql. Make a table with a field for the image filename, and a number of clicks, then put something like this on the page that the image takes you to.
CODE
<?php
$connection = mysql_connect("host","username","password");
mysql_select_db("database");
$select = "select clicks from table where imagename = 'Image filename';";
$sresult = mysql_query($select);
$sarray = mysql_fetch_array($sresult);
$clicks = $sarray+1;
$query = "update table set clicks = '".$clicks."' where imagename = 'Image filename';";
mysql_query($query);
mysql_close($connection);
?>

That's assuming you know the basics of PHP and MySQL. If not, I can tell you in full.
Go to the top of the page
 
+Quote Post

Reply to this topicNew Topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No new   36 techocian 5,367 21st December 2008 - 06:47 AM
Last post by: kpxchunsa
No New Posts 12 yungblood 3,290 17th December 2008 - 03:53 PM
Last post by: ryantommo
No New Posts   18 chseng 2,872 15th December 2008 - 11:15 AM
Last post by: tek3D
No new 28 donitoz 2,005 13th December 2008 - 08:25 PM
Last post by: quack
No New Posts   18 x2crazy4shadyx 2,479 16th November 2008 - 11:18 PM
Last post by: Guest
No New Posts   4 Captain Jerry 1,367 12th November 2008 - 11:32 PM
Last post by: Guest
No New Posts   4 khalilov 291 21st October 2008 - 03:44 PM
Last post by: yordan
No new   68 specter 6,391 5th October 2008 - 09:00 AM
Last post by: Quatrux
No New Posts   2 ejasoft 875 23rd September 2008 - 11:30 AM
Last post by: magiccode9
No New Posts   13 malinas 3,508 1st September 2008 - 10:30 PM
Last post by: Jammerjd123
No New Posts   18 nakulgupta 3,457 31st August 2008 - 09:39 PM
Last post by: Guest
No New Posts   6 meeces2911 1,348 31st August 2008 - 06:32 AM
Last post by: Guest
No New Posts   18 Darren 2,727 24th August 2008 - 03:25 AM
Last post by: shotgun
No New Posts 12 clovis 2,266 18th August 2008 - 10:54 AM
Last post by: Guest
No New Posts