//flex table opened by JP

Click to See Complete Forum and Search --> : Hit-counter


kanchu_deep
07-17-2001, 10:46 AM
Hi there,

I have my homepage on Tipod (kanchu_deep.tripod.com). I want to add a simple counter to it. It would be nice if it logs the date+time of visit to a text or html file and also not count visits by me. I do not want to use any third-party site to do this. Could some one send the code to do this or point to a link with the same? I was using theCounter.com earlier but now most of its features are gone. I know a little bit of JavaScript also.

Thanks
Deep

izzzy12k
07-17-2001, 06:44 PM
here is some code for date and time, as for IP address info still looking.

<SCRIPT LANGUAGE="JavaScript">
<!--
// Store the date in a variable
var d = new Date()
var dateText = ""

// Get the current day and convert it to the name of the day
dayValue = d.getDay()
if (dayValue == 0)
dateText += "Sunday"
else if (dayValue == 1)
dateText += "Monday"
else if (dayValue == 2)
dateText += "Tuesday"
else if (dayValue == 3)
dateText += "Wednesday"
else if (dayValue == 4)
dateText += "Thursday"
else if (dayValue == 5)
dateText += "Friday"
else if (dayValue == 6)
dateText += "Saturday"

// Get the current month and convert it to the name of the month
monthValue = d.getMonth()
dateText += " "
if (monthValue == 0)
dateText += "January"
if (monthValue == 1)
dateText += "February"
if (monthValue == 2)
dateText += "March"
if (monthValue == 3)
dateText += "April"
if (monthValue == 4)
dateText += "May"
if (monthValue == 5)
dateText += "June"
if (monthValue == 6)
dateText += "July"
if (monthValue == 7)
dateText += "August"
if (monthValue == 8)
dateText += "September"
if (monthValue == 9)
dateText += "October"
if (monthValue == 10)
dateText += "November"
if (monthValue == 11)
dateText += "December"

// Get the current year; if it's before 2000, add 1900
if (d.getYear() < 2000)
dateText += " " + d.getDate() + ", " + (1900 + d.getYear())
else
dateText += " " + d.getDate() + ", " + (d.getYear())

// Get the current minutes
minuteValue = d.getMinutes()
if (minuteValue < 10)
minuteValue = "0" + minuteValue

// Get the current hours
hourValue = d.getHours()

// Customize the greeting based on the current hours
if (hourValue < 12)
{
timeText = " at " + hourValue + ":" + minuteValue + " AM"
}
else if (hourValue == 12)
{
timeText = " at " + hourValue + ":" + minuteValue + " PM"
}
else if (hourValue < 17)
{
timeText = " at " + (hourValue-12) + ":" + minuteValue + " PM"
}
else
{
timeText = " at " + (hourValue-12) + ":" + minuteValue + " PM"
}
// Write the greeting, the date, and the time to the page
document.write(dateText + timeText)
//-->
</SCRIPT>


Hope this helps a lil...


[This message has been edited by izzzy12k (edited 07-17-2001).]

izzzy12k
07-17-2001, 06:48 PM
As for a counter, I have a CGI counter.

Not sure if you want or can use a CGI on your page.

izzy

kanchu_deep
07-18-2001, 04:03 AM
Hi there,

Thanks for the java-script code izzzy12k, althought it is not exactly what I wanted and I could have written it myself also. But your thought is appreciated.

I think Tripod allows one to use cgi script. I have no idea about cgi. Could you send me the cgi code for the counter? It would also be nice if it could log the date and time of hit to a text/html file. Also could it be configured (thorugh cookies I suppose) not to log visits by me?

Thanks in advance...

izzzy12k
07-18-2001, 12:13 PM
Here's the link to the counter I have, they have it setup as JAVA/CGI counter. I got rid of the JAVA part and simply used the CGI component.

http://www.chami.com/counter/classic/

Good luck!

kanchu_deep
07-19-2001, 09:05 AM
Hi,
Thanks for the link. Will give it a shot...

Female
07-21-2001, 05:55 PM
Izzzy
May I ask a very basic question being new to webpages? I have one started and want to have a counter too. Can I simply cut and paste this code into the webpage? Will it cut into how much room I have available? Can you have HTML code and Javascript code in the same webpage??? Really green at this. Thanks.

Ka0ticMiND
07-21-2001, 09:49 PM
i'm not exactly izzzy12k, but i can still answer the question.
you can cut and paste the code that izzzy12k posted, the javascript code, into your webpage,and you are able to have HTML code and javascript code in the same page.

izzzy12k
07-24-2001, 10:47 AM
the code I posted above is not for a web counter, it is to display the time and date a visitor hit your page.

Go to the link I posted above to download their free web counter. If you are having problems getting it to work, it may be that your ISP does not have perl/CGI turned on.

There are many free pre-setup remote-hosted counters on the web, some require a little ad display on your site in exchange. But these will not work if you are setting up an Intranet on a secure network, public internet websites or pages.

Good luck!