By Niklas Forsberg
on July 5, 2002
-
Version: 1.1
Type: Full Script
Category: Other
License: GNU General Public License
Description: This small snippet just makes it possible to display the online-status of a ICQ-user account. It is originally written to display the status in plain text, but with a small change you can use images instead!
?
<?
#
# ICQ Status Indicator ver 1.0
# Written by Copycat, 2002 for
# usage at LANforum.
#
copycat@bunkerlan.org#
#
# VERSION 1.1 INFORMATION
# I have fixed a parse-error telling
# that there is a Unexpected T_VARIABLE
# on line 11. Otherways, there is nothing
# new in this version.
#
$uin = 71133653 // The ICQ number to indicate
$fp = fsockopen("wwp.icq.com", "80"
; // Open connection to ICQ-database
fputs($fp,"GET /scripts/online.dll?icq=" . $uin . "&img=24 HTTP/1.0nn"
; // Get the size of image
// DO NOT CHANGE ANYTHING INSIDE THE WHILE-LOOP!
while (!feof($fp)) {
$img = fgets($fp,1024);
$img = preg_replace("/s+$/","",$img);
$img = str_replace(" n","",$img);
$img = str_replace(" r","",$img);
if (preg_match("/Location:s+/lib/image/0,,6545,00.gif/",$img)) {
$ICQStatus = "Online!"; // Message if user is online
}
if (preg_match("/Location:s+/lib/image/0,,6544,00.gif/",$img)) {
$ICQStatus = Offline!"; // Message if user is offline
}
if (preg_match("/Location:s+/lib/image/0,,7019,00.gif/",$img)) {
$ICQStatus = "Not available!"; // Message if user has the Web Aware off.
}
}
fclose($fp);
print "User "$uin" is currently $ICQStatus";
?>