IRC status indicator
From Blitzed
The Blitzed IRC Network provides a status indicator service to its users. This means you are able to show your current IRC status on your webpage. It was created by taras and then extensively modified. It is currently maintained by the web team.
Please note that the script has moved from http://www.blitzed.org/online.phtml to http://scripts.blitzed.org/userstatus.php
NOTE: By enabling NickServ PRIVATE, you will always show as being offline.
Contents |
[edit] How to use?
The status indicator is pretty easy to use. You can choose between three styles: digit (mostly for parsing within other PHP scripts), picture (our nice indicator pics from the website) and text (online, offline, away). Here are the explanations to each one of them.
[edit] The "picture" style
This one will display our nice little pictures also used on our webpage. These are the following:
= Offline,
= Online,
= Away,
= In the pub
To get the "pub" status, include "pub" in your away message
To use it you have to include it as an image like that: (Remember to replace nickname with your Blitzed nickname)
<img src="http://scripts.blitzed.org/userstatus.php?nick=nickname&style=picture"
alt="Blitzed Status Indicator" />
[edit] The "text" style
If you need a text as indicator, it's no problem. Just use the text style. The available outputs are: "online", "offline", "away" and "pub"
If you want it generated by the server you'll have to use this in a PHP script:
<?php
$online = join('',file("http://scripts.blitzed.org/userstatus.php?nick=nickname&style=text"));
echo $online;
?>
[edit] The "javascript" style
You want to use the text-style on your homepage, but you don't have PHP on your webspace? We've already thought of you :) You use this one:
<script src="http://scripts.blitzed.org/userstatus.php?nick=nickname&style=javascript"
type="text/javascript"></script>
[edit] The "digit" style
The available outputs are:
0 = offline, 1 = online, 2 = away, 3 = pub
In a PHP script you can use it this way:
<?php
$online = file("http://scripts.blitzed.org/userstatus.php?nick=nickname");
if ($online[0] != 0)
echo "I am online";
else
echo "I am not online";
?>
[edit] The "detailed" style
This is an extension of the digit style that includes the current nickname in use and the away message (if set). the sample output is:
2 IZS-Work at work
In a PHP script you can use it this way:
<?php
$online = file("http://scripts.blitzed.org/userstatus.php?nick=nickname&style=detailed");
if ($online[1] != 0)
echo "I am online as ".$online[2];
else
echo "I am not online";
?>
More advanced example using caching (sometmpfile must be writable by the web server):
<?php
$statuscachefile = "sometmpfile";
$nick = "nickname";
if(@filemtime($statuscachefile) + 120 < time()) {
$online = @file("http://scripts.blitzed.org/userstatus?nick=$nick&style=detailed");
file_put_contents($statuscachefile, $online, LOCK_EX);
} else {
$online = @file($statuscachefile);
}
if(!count($online))
echo "(no data)";
else if($online[1] == 0)
echo "Offline";
else if($online[1] == 1)
echo "Online as $online[2]";
else if($online[1] == 2)
echo "Away (" . htmlspecialchars($online[3]) . ")";
?>
[edit] New styles
If you want to propose some new style feel free to email us.