I need a script that will log how many people are currently on a site...

…that works in php (ie doesn’t need an .shtml file extension) and that isn’t open to security vulnerabilities. It can be perl, php, javascript–I don’t care. I need it to just spit out a number of how many people have visited any page in the site within the last X minutes.

Try http://whos.amung.us/ (I’ve not used them myself but that’s one of the most popular).

Thanks, but I want a script that I can run on my own site, not a hosted solution. And I want it to be text based so I can make the text the same color as the background, so that only I know where it is and will be able to see it.

Check with your host to see if they have a log viewer for you to use.

If not, this one looks ok. Doesn’t look vulnerable but I’m not going to parse every line to see.

Use .htaccess to make the totals display page password protected.

I’d rather be able to look at any moment and see how many are on the site by mousing over some text rather than examining logs. I want a more “right now” kind of solution.

(I can get my usage stats at any time through Google Analytics, if that’s what I was looking for)

I meant a log viewer that has the ability to parse the data in your site’s logs and tell you who is on right now. Just something already built in to your hosting package. That’s why I said “log viewer” and not “logs.”

It’s vulnerable. Unescaped $referring parameter in logvisit().

On the off chance you’re using WordPress, there’s this plugin, which features a sidebar widget that does what you want. I haven’t checked the code but it’s popular and actively maintained.

Not useing wordpress. And I don’t want to have to login to my hosting service every time I want to see. I just want to mouseover the invisible text and know. I know it’s possible because I have it on another site of mine, but that script won’t run on this other site for some reason.

You don’t have to log in to see the number of visitors with whos.amung.us and similar services. They put the number in your sidebar or footer. If you don’t want it visible to others then that’s a different story.

I don’t see how this could be possible with JavaScript alone. You need something that runs on the server, not the client.

Yeah I think that with js you’d need to have a secondary script. The one I have on another site is a cgi script in perl that displays using js… but when I tried to make it work on this other site, she no workie.