Register | Login | |||||
Main
| Memberlist
| Active users
| ACS
| Commons
| Calendar
| Online users Ranks | FAQ | Color Chart | Photo album | IRC Chat |
| |
0 user currently in Programming. | 3 guests |
Acmlm's Board - I2 Archive - Programming - PHP Online Indicator? | | | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
User | Post | ||
Elric Chasupa Currently Playing: You Like A Lute. Level: 40 Posts: 92/687 EXP: 440016 For next: 1293 Since: 03-15-04 From: Melniboné Since last post: 6 hours Last activity: 6 hours |
| ||
Anyone know if there's some kinda php script you can use to geneatre an image showing your online status? I'm thinking something that acts similar to the ICQ online indicator. Or is this not possible? |
|||
Vystrix Nexoth Level: 30 Posts: 110/348 EXP: 158678 For next: 7191 Since: 03-15-04 From: somewhere between anima and animus Since last post: 3 days Last activity: 2 days |
| ||
I'll assume that:
<?php the Content-Length line is not necessary; it's just a nicety. the Content-Type line, however, is required.anyhow, all it does is figures out whether the user is online, and outputs either 'online.png' or 'offline.png' (as the document content) accordingly. if you want to use .jpg images instead of .png, just change the Content-Type line to image/jpeg instead of image/png HTH |
|||
Elric Chasupa Currently Playing: You Like A Lute. Level: 40 Posts: 93/687 EXP: 440016 For next: 1293 Since: 03-15-04 From: Melniboné Since last post: 6 hours Last activity: 6 hours |
| ||
Originally posted by Vystrix NexothI don't have anything for this. I was really hoping it'd be a simple script, and then I could just whip up a couple of images, upload everything, and be good to go. I knew it wouldn't be that easy, but I could hope hope, right? Also, since I know that you're knowledgable about .png images, is there any way to have a .png with a fully transparent background, and NOT have to reduce it to 256 colors? Paint Shop Pro forces you to reduce an image to 256 colors before you can add a transparency, regardless of the image you're working with. |
|||
Darth Coby Vire Dacht je nou echt dat het over was? Dacht je nou echt dat ik gebroken was? Nee toch? Nou kijk eens goed op uit je ogen gast. zonder clic heb je geen kloten tjap... bitch Level: 55 Posts: 513/1371 EXP: 1240774 For next: 73415 Since: 03-15-04 From: Belgium Since last post: 2 days Last activity: 9 hours |
| ||
You'll need to write a program that keeps telling the script that your online, a simple VB program that sets a variable each minute'll do. | |||
Elric Chasupa Currently Playing: You Like A Lute. Level: 40 Posts: 97/687 EXP: 440016 For next: 1293 Since: 03-15-04 From: Melniboné Since last post: 6 hours Last activity: 6 hours |
| ||
Oh, OK. No problem. Except that I don't know VB. Sucks to be me, eh? I'm pretty much outta luck, since I don't have the knowledge needed to make something like this, but that's OK. This was more of an idle curiosity than an, "OMFG! I GOTA HAEB IT NOW!!11" thing. Thanks for the info, though. |
|||
Vystrix Nexoth Level: 30 Posts: 111/348 EXP: 158678 For next: 7191 Since: 03-15-04 From: somewhere between anima and animus Since last post: 3 days Last activity: 2 days |
| ||
using VB? for one, I assume elric's server does not support ASP, and even if it did, that's way too complicated a solution. the board automatically records the last time you were online (meaning, you viewed a page while signed in). the board uses Unix-style timestamps (which is the number of seconds since 01/01/1970 00:00 UTC), so: if ($TimeUserWasLastOnline > time() - 3600) where 3600 = how long you want a user to be considered "online", in seconds (which in this case means one hour). as for PNGs, that's a problem with the program you're using, not the PNG format itself. I can think of two ways to add binary (either 100% opaque or 100% transparent) transparency to an RGB image:
I found this program a while back, and have found it to be helpful. to do the second method (assigning one color as transparent), do this:
...now, whether that will work in Internet Explorer or not, I don't know; I doubt that it will. alternately, you can try this, using the same program:
again, hope this helps. (edited by Vystrix Nexoth on 04-25-04 01:59 PM) |
|||
Elric Chasupa Currently Playing: You Like A Lute. Level: 40 Posts: 99/687 EXP: 440016 For next: 1293 Since: 03-15-04 From: Melniboné Since last post: 6 hours Last activity: 6 hours |
| ||
Well, it's not for my board, actually. I'm registered at Gaia Online, a phpBB. Currently, the Online/Offline status is disabled, and the list of online users is hidden unless you click a link, since there are generally over 3,000 users on at any given time (there are 5,866 online right now). I just wanted to add a link to a php file as an image (i.e. < Of course, the more I think about it right now, I realize that even with a script, I'd probably have to edit my profile to make it show the right image. And I wanted a script so that I wouldn't have to do that, since I'd probably forget to edit me to offline before I signed off the net. Ah well. For the .PNG files, I do include one color for the transparency that isn't used for anything else. However, as soon as I click the button to set the transpareny, it pops up a window, telling me that the image HAS to be reduced to 256 colors. I even tried PhotoShop once, and the same thing happend. Same thing happened with the few different image editors my wife has on her laptop. The ONLY place I see ANYTHING that mentions Alpha channel is things involving something called "masks". I have NO idea what that is... |
|||
Vystrix Nexoth Level: 30 Posts: 115/348 EXP: 158678 For next: 7191 Since: 03-15-04 From: somewhere between anima and animus Since last post: 3 days Last activity: 2 days |
| ||
mask == alpha channel anyhow, what you do is allocate a transparent color, but without actually making it transparent in photoshop. just have it be a plain old 256-color image, no transparency or anything. save it. then, open it in TweakPNG and define that color as being transparent, yourself, as described in my previous post. and I assumed you were making this for an AcmlmBoard; I don't know what format phpBB uses to record a user's online status, so I can't help you there (although if it uses unix timestamps like AB does, then the basic method is the same). |
|||
kiwibonga Double metal axe Level: 27 Posts: 92/266 EXP: 106040 For next: 10119 Since: 03-15-04 From: Montreal, QC, Canada Since last post: 126 days Last activity: 3 days |
| ||
You know, you can simply use a header() redirect for this < if(user is online) { $file="online.png"; } else { $file="offline.png"; } header("Location: http://www.whatever.com/$file"); ?> As for something that lets people know whether you're online... I have 3 ideas: 1. Make a desktop background item which is actually a php page that updates the last online time and keeps opening the page every 20 minutes or so 2. If you're using AIM, find a way to change the url where AIM fetches the ads and make that your online status refresh script 3. If you use IRC, make a simple script that opens the page with a timer, it would update your status whenever the IRC client is open. It would prevent you from writing a program |
|||
Vystrix Nexoth Level: 30 Posts: 116/348 EXP: 158678 For next: 7191 Since: 03-15-04 From: somewhere between anima and animus Since last post: 3 days Last activity: 2 days |
| ||
4. have the system (message board, etc) keep track of the last time you were online (which, for example, AB already does). when you go to check if a user is online, compare that time to the current time. much simpler, less klugy, is accurate to within one second, unlike the other methods which are accurate only to within 20 minutes (or however frequently the scripts are run), and
as for the header() suggestion, it did occur to me, however, having different results returned in the same file creates a canonical name for online status. but using such a method by no means means that you do not "have to program"!
I'd rather use the pass-through method myself, but the redirection method would be: <php by no means perfect code (technically, it is in violation of HTTP spec by giving relative URIs in the Location: fields) but it should work in most cases. |
|||
Elric Chasupa Currently Playing: You Like A Lute. Level: 40 Posts: 103/687 EXP: 440016 For next: 1293 Since: 03-15-04 From: Melniboné Since last post: 6 hours Last activity: 6 hours |
| ||
This is not a board I run, just one I visit, so I can't have it do anything. Sorry. |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
Acmlm's Board - I2 Archive - Programming - PHP Online Indicator? | | | |