To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > PHP Help > Coding

Coding Help with PHP coding

Reply
 
Thread Tools Rate Thread Display Modes
Old 07-10-2006, 09:39 AM   #1
PHPist
Member
 
Join Date: Jul 2006
Location: Ukraine
Posts: 41
ICQ-user in on-line or not ?

Hi to all !
I have questions for you.
Now I build some CMS system and it include function to check, that ICQ user in on-line or not. Do you have any minds ?
PHPist is offline   Reply With Quote
Old 07-10-2006, 11:14 AM   #2
radam
Junior Member
 
Join Date: Mar 2004
Location: Cheshire, UK
Posts: 12
PHPist,

there are two ways you can do this. The first is simple but less flexable, the second is more complex but also more flexable.

Option One

Go to: http://www.icq.com/features/web/indicator.html

You can simply download an indicator that will show if you are online or not. However, this does not allow you to access your status in your PHP code.

Option Two

In your php code, do somthing like:

Code:
<?PHP

$img = file('http://status.icq.com/online.gif?icq=YOUR_ICQ_NUMBER_HERE&img=5');
echo md5($img);

?>
Do this for when you are offline and online on ICQ, and you should get two different hashes, for example 'abc' (when online) and '123' (when offline) (but of course, yours will be much longer). Now, use this code to detect if you are online or not:

Code:
<?PHP

$onHash = 'abc';
$offHash = '123';

$img = file('http://status.icq.com/online.gif?icq=YOUR_ICQ_NUMBER_HERE&img=5');

$hash = md5($img);

if($hash == $onHash){
   //you are online
}else if($hast == $offHash){
   //your are offline
}


?>
That should do it. However, this is untested, i just figure that it should work. You may need to play around a bit.
__________________
Radam

TextPaste.net Webmaster
radam is offline   Reply With Quote
Old 07-10-2006, 11:34 AM   #3
PHPist
Member
 
Join Date: Jul 2006
Location: Ukraine
Posts: 41
Great ! Thanks.
That's full example:
<?
$onHash='501aa29a5565a264b1257b66bcbf82ea';
$offHash='e6344d371ce6341148c6f362d8ff0d84';
$img =join('', file('http://status.icq.com/online.gif?icq=261502771&img=5'));
$hash = md5($img);
if($hash==$onHash){
print"Пользователь в сети !";
}elseif($hash==$offHash){
print"Пользователь в оффлайне !";
}
?>
PHPist is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 08:15 PM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.