For WileyKat (Counter)

How about that grafical counter??  Please be more detailed I do not understand it all.  Thanks
Who is Participating?

Improve company productivity with a Business Account.Sign Up

WileyKatConnect With a Mentor Commented:
I have sent you the counter via email and patiently (ok, maybe not patiently :) await your acceptance of this answer. If the counter does not work, please email me and I will try to identify the problem.
Okay, I'll explain the concept in this comment, but I may have to email you the code; a graphical counter uses quite a lot of it. But anyway, here goes:

I assume you know how a basic text counter works. Every time it's called, it opens it's count file, reads the number, increases it, writes it back to the file, and prints the number to the browser. It's the simplest and least useful counter that exists.
More complex counters will check if the IP that's requesting the count has visited the counter in the last x minutes, to prevent someone from flooding the counter.
It's the good counters, the ones that use graphics, that really get people's attention. A graphical counter must do MUCH more than just output a character string to the browser.
A graphical counter starts the same way a textual counter would, by opening it's count file, reading it, and increasing the count by one. However, it must then take the number it gets and break it down into individual numbers. For example, the number 12345 will be broken down into the numbers 1, 2, 3, 4, and 5. If you didn't want to have to worry about this, you'd need one GIF file for EVERY number from 0 to whatever the maxiumum would be. Say the counter went only to 10000. At one K per file, that's STILL 10M+1K of files. To get around this rediculous thing, a graphical counter uses only ten GIF files, namely the numbers from 0 to 9. It then takes EACH number it's broken down and gets the GIF file representing that number. It then must paste that GIF together with the GIFs of the other numbers in the count.
For example, using 12345 again, the counter will take first the graphic file for the number 1 (I'll use 1.gif as the filename). It will read that file, create an empty GIF image, copy the GIF image data from 1.gif into the new GIF, and close 1.gif. It will then take 2.gif, read it, COPY it into the new GIF as a separate part of the picture, and close it. This process will continue for 3.gif, 4.gif, and 5.gif.
The counter will then output the final conglomerate GIF to the browser and save the new count to the count file.
The hard part is in combining the GIF files, something that isn't simple by any means. I don't do it myself. I use a public-domain graphics library written by someone else, a library called gd. It's that code I use to write my graphical counters, and it works very well.
Let me summarize a graphical counter CGI (one that doens't do anything EXCEPT show the counter; it doesn't handle flood protection or any of that):
1. Open the count file.
2. Read the current count.
3. Increase that count by one.
4. Break that count down into it's component place numbers. (1s place, 10s place, etc.)
5. Create an empty GIF image.
6. Open the GIF file for each component number and add that file's data onto the end of the final GIF.
7. Print the final GIF to the browser with a MIME type of image/gif.
8. Save the new count to the count file.
9. Close the count file.
10. Exit.

I'll put together the code for the graphical counter I've described meantime. Do you have any questions on what I've outlined here? (Don't ask me about the GIF format or about how exactly the combination of GIFs is done, I really don't know, though I'm trying to learn :-| ).
steath_acidAuthor Commented:
Ok, I understand this.  What do you enter the code in??  Another wise is it HTml, JAVA, JAVSCRIPT, ect???  Also email the code to,
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

I'll get that code to you as soon as it's finished. My apologies in advance for any delays. BTW, I'll most likely be doing the code in Perl; it's the best language for it. If not Perl, then C.
You can do counter in Javascript, but there're pages such as geocities and many other,
that can give you free counters that automatically counts - you need only to add link to them from your page.
steath_acid, that counter is on it's way to you via email. I would appreciate some points for my work. to jack_p50: I believe this question specifically said: For WILEYKAT. I would have answered the question myself if you hadn't (excuse this term:) butted in. So, I hope you'll excuse me if I ask you to butt out so steath_acid can give me the points I worked for.
steath_acidAuthor Commented:
Get out of here jack_p50 it says for WileyKat so if you want to comment fine but please do not post answers!
steath_acidAuthor Commented:
Here are your points but I still have not tested it, I will email you if it does not work.
steath_acidAuthor Commented:
here WileyKay go to:
and post a answer it does not matter what you say I will give you the points.  The question seems to be dead and you probely deserve the points anyway. Also if you do not post a answer in one week i will put the points up for grapes to anyone.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.