Teen Programmers Unite  
 

 

Return to forum top

online notification - cgi?

Posted by D_Dave [send private reply] at January 10, 2003, 02:24:39 PM

I was wonderining ways i could show when i am online via my website. An example being the ICQ online status, you know where some forums and websites you have the flower by your name, and somehow it knows when you are and are not online - something like that.

Basically i would like to do that with myself, but display when i am running a certain program (written in VB6, i coded it so can edit it).

The obvious option would be to upload a something which says im online, then the edit this when i go offline. However this poses problems such as the PC crashing, it would still display online untill i changed it back...

Also, a timer like thing which displays "offline" unless something is uploaded, it would then have a timer which displays "offline" again unless it was re-set before hand.

This would be OK, except i may have a number of users, they would need to be listed on the page, such as; "1 online" "2 online" etc. Also, these numbers would change.

Finaly, small amounts of info would need to be uploaded, such as name, another line of text and maybe a short description, all of which the user would have offline, perhaps as a number of .txt files made by my program.

Just one other thing - i have no programing experience in any language other than VB6 at the moment...

Any help or information would be much appreciated, as would links etc.

Thank you for your time.

Dave

Posted by CViper [send private reply] at January 10, 2003, 02:57:04 PM

I guess you mean something like the "Browsing Now" section on the left on this page? :D

Anyway, assuming you want to do this with a cgi (as the title suggests), your cgi would have to register any accesses made to it, store them somewhere with all the data you want, plus a time-stamp; if the user is already registered, just update the time-stamp.

Also each time your cgi is accessed, it would also have to go through the list of online users, check the time-stamps, and remove any entries that are older than some predefined time.

Each users data could be stored in cookies, or, if you'd rather use some own application for the notification stuff, you could pass it as GET or POST data.
Obviously you need some server that hosts the cgi for you, but that might not be a problem for you...

(Ok, these are just some thoughts I had)

Posted by D_Dave [send private reply] at January 10, 2003, 03:09:11 PM

Thanks - any links etc or tuts which you'd recomend? I'm guesing that I'm gonna have to learn a new language :-( or :-) as the case may be...

Anyone else?

Thanks for your reply

Dave

Posted by 142857 [send private reply] at January 10, 2003, 07:21:29 PM

I always identify CGI with perl, though I guess CGI's just getting things from STDIN to STDOUT, or so I hear. I think I've seen it with C, but your server needs a C compiler. But perl, I guess, is the most supported method here.

programmingtutorials.com has lots of good programming tutorials. The one on CGI is:
http://www.programmingtutorials.com/tutorial.asp?id=CGI

Posted by CViper [send private reply] at January 11, 2003, 04:52:46 AM

I write CGI's in C/C++ :) And theoretically you could write them in VB too, but you'd need a server capable of executing vb-apps.

here's another page with lots of stuff about cgi's:
http://cgi.resourceindex.com/

Posted by buzgub [send private reply] at January 11, 2003, 05:48:07 AM

I would probably make it so that when you came online, a program on your computer would notify your webserver that you are online. Then, whenever a request goes through to the webserver it would check if it has pinged your machine in the last minute. If not, it would ping your machine and record that it had done so. If your machine did not respond, then it would register you as offline and no further pinging would be done until you registered yourself as online once again. If your machine did respond, you would continue to be registered as online.

The main weakness in this scheme that I can see is that if your computer goes offline and another user of your ISP picks up the same IP address within a minute, then you will stay online.

You can't write apps that use CGI in VB, because VB doesn't talk to stdin/stdout. You could use VB.net, though, if you had a server with the CLR.

The ICQ flower knows your online/offline status according to if you are logged into ICQ.

Posted by D_Dave [send private reply] at January 11, 2003, 05:55:56 AM

Thank you - you say the ICQ flower knows your online/offline status according to if you are logged into ICQ - well thats exactly what i want to be able to do :-) Also, i know i said cgi - but my webserver will also support php - do you think it would be possible for me to use this? Also, what is easier, cgi or php? (i will use he easiest one lol)

Thank you very much

Dave

Posted by buzgub [send private reply] at January 11, 2003, 06:16:28 AM

php is probably easier for you to use. php is a programming language; cgi is a way of executing programs written in any language. To learn php, you just have to learn the language. If you wanted to use cgi, you'd have to learn both a language and an interface.

A program on your computer could notify the server that it was alive by fetching a url like http://D-Dave.com/online.php?who=D-Dave&change=online&password=blahdibla...

changine the "change" parameter in that url to "change=offline" might be a way of explicitly noting that you are going offline.

Posted by CViper [send private reply] at January 11, 2003, 01:54:58 PM

well, if you have a own server (eg. somewhere you can run whatever you want), you might want to avoid cgi & co; just run a server on some port to which your clients connect. Since the server is running all the time, it can actually check back on the clients (by pinging or by attempting to connect to the client).
With cgi's you "can't" check back on the clients since cgi's only run when someone is requesting it over http (well, you can spawn a new process, but the people running the server usually won't be too happy about that...)

You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.