PDA

View Full Version : editable counter



spitfire
02-27-2007, 09:27 PM
hi,

i am looking for a script where my visitors can generate an output which counts up from a given date and time until this day, and shows it in a banner-like picture. it's gonna be a sobriety-counter. so every visitor would like to be able to generate their own counter, and then show it in their signature on the forum.

maybe one of you have seen this script on f.e. birthday-pages, or pregnancy-communities. (like snugglepie.com)

i have also php and mysql-fascilities, for if its worth to know..

thanks in advance

every help is appreciated!

jscheuer1
02-28-2007, 07:42 AM
Even though I don't know how to instruct you to proceed, you should definitely use them (php and mysql) for this. That is because for something like this that could become a positive reinforcement for folks, you would not want to risk its becoming a negative trigger were something to go wrong with it. If it is done with javascript, that could easily happen.

spitfire
02-28-2007, 08:25 PM
oke thanks for the suggestion!

djr33
02-28-2007, 10:34 PM
Depending on how complex you want to make it, this is very simple, really.

Use a database, store the users' date(s), then just subtract date-time() (where time() is the function for current time) and you have the amount of time until it hits the goal.

http://php-mysql-tutorial.com
basic php/mysql info there... should be plenty for this.

http://www.php.net and search for "date" (and time) in the function search box near the top.

That should be enough to get you started.

spitfire
03-01-2007, 01:09 AM
oke thanx, i'm gonna read and practice

for later-on: any idea how to get this on an image in a bannerlike-way? so one month or 6 months can be visualy shown on this?

djr33
03-01-2007, 05:25 AM
the PHP GD library can do this.

Look up imagejpeg() on the PHP site to get a start on image functions and look around for related into. That gets complex quickly and it's also kinda buggy with a lot less help than normal functions. However, it's very cool too.
Another idea would be to use the banner as a background and the text in that div/cell/etc.
But... if you do need the image, there are ways with PHP... just takes some time.

jscheuer1
03-01-2007, 05:46 AM
As long as the math and record keeping were done server side so as to prevent any foul ups due to users disabling javascript and/or the cookies, the rendering as an image or graph could be done via javascript as long as a text only fall back for non-javascript enabled browsers was also present.

djr33
03-01-2007, 10:36 AM
Rendering an image with JS?
Do you just mean creating it by piecing together number chunks? You could do the same with PHP.
Or does JS actually have some real image ability?