Posted by
Grim..., 13:23, 26th June 2002:
I've had a groovy idea for a counter, but I'm not sure how to implement it.
What I want it to say is basically:
3,045 people have visited this page (xx% of visits during work hours).
How do I make it figure who visited between 9am and 5pm?
Posted by
cal, 13:45, 26th June 2002:
what language are you implementing this in?
Posted by
Grim..., 14:00, 26th June 2002:
.asp would be nicest.
Posted by
cal, 15:02, 26th June 2002:
ok, try this:
http://www.iamcal.com/files/asp_counter.txt
bear in mind i don't program in ASP and i do't have a server to test it on. la la la....
Posted by
Sul, 15:19, 26th June 2002:
you could use SulBASIC with its magnificent error tracking:
THIS_A_FUCKING_VARIABLE iCounter AS INTEGER
iCounter = GET_FIST_LINE_FROM_FILE("soddingcounterthingymebob.dat")
IF A_BASTARD_ERROR_HAS_OCCURED
TELL_USER "YOU BROKE MY WEEEEEEEEBSITE YOU CUNT!"
Exit
ELSE
IF SOMEGIBBON COMES_HERE BETWEEN "09:00" AND "17:00"
iCounter = iCounter + 1
SAVE_TO_FILE "soddingcounterthingymebob.dat", iCounter
ELSE
FUCK OFF!
END IF
END IF
not sure how this is going to look when posted, sorry if it look shit, I'll get me coat
Posted by
Sul, 15:26, 26th June 2002:
I've never known why nobody has taken up my offer of turning SulBASIC into a real language... I'D use it!
oh and to put it on the site:
People have visited this page (<% iCounter + 1 %>% of visits during work hours).
Posted by
ell, 16:42, 26th June 2002:
SulBasic, written by author BasicSul?
I'd use it for a laugh... and you know you would too Cal. Bloody esoteric brainfuck lover.
Posted by
ell, 16:44, 26th June 2002:
Heh, if I had a penny for every time I've harrassed Cal for a nibblet of code help (missing my == tester in php comes to mind) ...I'd be able to hire him to do the coding for me. :-S
Posted by
cal, 17:23, 26th June 2002:
hey - you haven't asked THAT many times ;)
Posted by
Grim..., 17:34, 26th June 2002:
Thanks m8
Posted by
Joe, 22:14, 26th June 2002:
here comes some feature creep:
As someone pointed out on metatalk.metafilter.com (which I really shouldn't be reading, let alone posting on) the first w in www stands for World.
To make your counter really accurate you'd have to take into account where the person is browsing from, presumably by doing some kind of lookup on their ip address and comparing the host with a database of known real world locations.
Then you'd have to figure out the browsers timezone and check if they are likely to be at work and update your counter accordingly.
I'd stick with Cals code if I were you.
Posted by
ghard296, 01:18, 27th June 2002:
Cal is god. Cal is god. Cal is god.
Posted by
cal, 08:23, 27th June 2002:
hi greg :)
joe: there's a MUCH easier way to do it. have an image based cgi counter. call it like this:
<script language="Javascript">
<!--
var d = Date();
document.write('<img src="/counter.asp?time='+d.getTime()+'">');
//-->
</script>
.
Posted by
Leo, 20:45, 27th June 2002:
ASP? PHP? MYSQL? javascript?
bloody hell.
you lot are dead clever, - I try coding pages in html sometimes and thats pretty tricky.
somebody should teach me, it would be fun, and i could put it on
my site oh wow, i did some html there, i feel big and clever now. go on, someone teach me stuff, and it will be fun and stuff woo!
Posted by
cal, 08:16, 28th June 2002:
i really like your
pixel people
and yout
shop's pretty good too
Posted by
sal, 12:22, 28th June 2002:
oh no, greg's here, time to take out the trash methinks ;)
Posted by
cal, 13:15, 28th June 2002:
*snigger*
Posted by
Leo, 20:19, 28th June 2002:
whos gonna teach me then, im sure you are all full of ideas for my site ;-)
Posted by
cal, 14:18, 1st July 2002:
what to you want to know?
Posted by
Leo, 18:11, 2nd July 2002:
errrrrr, well i suppose i want to know how to make, errrrr, clever stuff for my website. Ok, so I havn't really thought that one through. That coding stuff is probably pretty hard, otherwise everyone would be doing it.
I can write things in BASIC though, i got this book from a jumble sale, and its old and has lots of funny pictures of BBC micros.
Does anyone even use BASIC anymore? it would be good if they do, because then i could make lots of fun things for my site, like, errrrrrrrrrrrrr, ah , yeah maybe there's a reason I havn't seen it mentioned anywhere. I tried to learn C once, but that was
really hard.
PHP is easy to learn. Here are some tutorials to get you started:
www.devshed.com/Server_Side/PHP
www.webmasterbase.com/article/228
Posted by
Sul, 00:04, 3rd July 2002:
Leo: If you understand BASIC then perhaps VBscript and ASP will be more up your street as a starting point
VBScript? I'd say that you'd definitely be better off learning JavaScript, unless you only want your Web site to work in IE. And I'd also recommend PHP over ASP, seeing as how it's open-source and not as proprietary.
Posted by
sal, 09:50, 3rd July 2002:
...is that the garbage man I hear coming up the street again? ;)
Posted by
cal, 16:35, 3rd July 2002:
mattj: i think the recommendation was based on the fact that vbscript and asp are BASIC, although i agree that javascript/PHP is a much more sensible route
sal: was that an obscure java object garbage-collection joke or are you on drugs?
hello, I need some help for my site in development, my good friend Leo suggested that you people know about code and databases and javascript and stuff, and that i should ask you what to do!
the site is temporarily
here but i need to find a way that people can add themselves and stuff, a bit like this site :-). help me people!
Posted by
cal, 07:53, 4th July 2002:
first up you'll need a host that supports php/mysql
i recommend
phpwebhosting who are cheap and provide all the right services.
then you need to get some php coding done
Posted by
Leo, 16:11, 4th July 2002:
wouldnt there be an easier way, like using cgi/perl?
Posted by
cal, 16:12, 4th July 2002:
php is easier than perl
Posted by
Leo, 18:03, 9th July 2002:
do you think you could help with a little javascript doodah, i have this program on my computer that takes a picture of my desktop and uploads it to my IP address , i dont understand it, but its dead clever and useful. The thing is that the ip numbers seem to change everytime im online, so i want to make a page which can redirect people to my IP to see the image. i found some vaugley useful javasript:
var ip = ''
function ipval() {
document.myform.ipaddr.value=ip;
}
window.onload=ipval
(sorry i cant get that to display here properly, it keeps actually making a text box instead of showing the code)
i dont really want to have to visit a page everytime i go online.
If its easy id be pleased if you could help me, but if its tricky then dont worry. I dont understand all this stuff really.
thanks :-)
Posted by
cal, 08:20, 10th July 2002:
you can't do this with javascript - that script will show you YOUR ip, but will show me MY ip.
You need to use a roaming dns service like
dns2go