Click to See Complete Forum and Search --> : Javascript Simple Counter


StacyB
04-03-2003, 12:51 PM
Can someone help me with a simple script for a counter. I want to simply count how many hits our webpage has received.

I am using Win2000 platform.

Thanks,
Stacy

Jona
04-03-2003, 12:55 PM
Well, it's possible but it'll take a heck of a lot of cookie and image scripting. It's always better to use a server-side language, but if you want a script like this... We can make it for you. :D

StacyB
04-03-2003, 01:02 PM
I am not using SSI. I did have a script that counted my cookies and it worked. The only thing, and maybe I am not understanding, it counted how many time "I" visited the site. I didn't want that. I wanted to count how many time anyone has visited the site. Question: If you base the count off of cookies, what will happen if you delete your cookies from your computer? So times I do that if efforts to 'clean' my hdrive.

Thanks ;)

Jona
04-03-2003, 02:30 PM
If it's not using cookies for only one user, it's basically impossible. You can't edit the page using Javascript (which you'd have to do) so you'd have to use a server-side language (not SSIs). Server-side languages are like: CGI/Perl, PHP, ASP, etc.

StacyB
04-03-2003, 02:35 PM
Ok. Would you help me in writing a code?

Thanks ;)

Jona
04-03-2003, 02:41 PM
What languages does your site support?

StacyB
04-03-2003, 02:59 PM
JavaScript

Jona
04-03-2003, 04:25 PM
Any server supports Javascript (because it's not server side, it's client-side)! Does your server support CGI, Perl, PHP, ASP ???

StacyB
04-04-2003, 11:07 AM
Our server support asp. Thanks ;)

Jona
04-04-2003, 03:59 PM
*Big gulp* Oh... I don't know ASP.. Sorry. Maybe you should post in the ASP forum instead.

StacyB
04-04-2003, 04:22 PM
After inquiring again ... yes, we can insert code for PnP or Perl as well ... yikes!

Jona
04-04-2003, 04:32 PM
*Bigger gulp* Ewww, I'll work on making a PHP counter for ya. But I'm going to be out of the office until Monday. Sorry... I'll work on it, though. But I can't promise anything because I don't have a test server available at the time. Perhaps Pyro or AdamBrill can help you. :D

StacyB
04-07-2003, 12:54 PM
Not a problem. I just arrived to our office today.

viravan
04-07-2003, 04:49 PM
I was looking for a hitcounter a little while back. Using google search engine I've found a lot of links as shown below:

http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=hitcounter


Eventually, I ended up writing my own...If your server support JSP, you can try something like this:


<table cellspacing=0 bgcolor=#cfcfcf>
<tr>
<%
Integer count=(Integer)application.getAttribute("counter7");
count=new Integer(count.intValue()+1);
application.setAttribute("counter7",count);
String counter=""+count;
while (counter.length()<4) counter="0"+counter;
for (int i=0;i<counter.length();i++) { %>
<td><img src="./thumb/d<%=counter.charAt(i)%>.gif"></td>
<% }
%>
</tr>
</table>


Hope this helps!

:)

V.V.

StacyB
04-08-2003, 12:40 PM
Hi Thanks. Our server supports asp, not jsp. Could you taylor the code to working asp?

viravan
04-08-2003, 01:46 PM
Check out the link shown below:

http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=hitcounter+%2Basp


:)

V.V.

StacyB
04-09-2003, 08:53 AM
Sad news. I received 'ASP' code for the counter. I didn't work either ... :(

Jona
04-09-2003, 10:17 AM
You can download a free PHP counter at: http://www.nathandickman.com/scripts/abaxcounter.zip