Author Topic: Why I`ve never saw (<b>{user_icq_status}</b>) thing working?  (Read 10494 times)

0 Members and 1 Guest are viewing this topic.

Offline universal

  • Full Member
  • ***
  • Posts: 213
    • View Profile
    • http://www.funny.lt
Why I`ve never saw (<b>{user_icq_status}</b>) thing working?
« on: April 21, 2005, 03:27:35 PM »
Quote
<tr>
    <td width="35%" align="right"><b>{lang_icq}</b></td>
    <td>{if user_icq}<a href="http://wwp.icq.com/scripts/search.dll?to={user_icq}">{user_icq}</a> (<b>{user_icq_status}</b>){endif user_icq}</td>
</tr>

Why I never saw (<b>{user_icq_status}</b>) thing working? And how to fix it? I`m talking about member_profile.html

You can try to look at this here: http://www.pramoga.net/member.php?action=showprofile&user_id=1
Again this addres?!
http://www.funny.lt

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: Why I`ve never saw (<b>{user_icq_status}</b>) thing working?
« Reply #1 on: April 21, 2005, 03:40:23 PM »
That's a VERY good question :)

I was also curious, but did not see it as a big problem (as my users do not fill their ICQ out very often)...
MAяTRIX


Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Why I`ve never saw (<b>{user_icq_status}</b>) thing working?
« Reply #2 on: April 22, 2005, 03:20:32 AM »
The ICQ url format has been changed, that's why it doesnt work anymore...
in includes/functions.php find:
Code: [Select]
function get_icq_status($uin) {
  // From: http://www.koehntopp.de/php/snippets.html#code-icq
  if (!is_numeric($uin)) return FALSE;

  $fp = @fsockopen('wwp.icq.com', 80, $errno, $errstr, 8);
  if (!$fp) return FALSE;

  $request = "HEAD /scripts/online.dll?icq=$uin&img=5 HTTP/1.0\r\n"
            ."Host: wwp.icq.com\r\n"
            ."Connection: close\r\n\r\n";
  fputs($fp, $request);

  do {
     $response = fgets($fp, 1024);
  }
  while (!feof($fp) && !stristr($response, 'Location'));

  fclose($fp);

  if (strstr($response, '4367')) return 'online';
  if (strstr($response, '4349')) return 'offline';
  if (strstr($response, '4386')) return 'disabled';
  return FALSE;
}
Replace it with:
Code: [Select]
function get_icq_status($uin) {
  // From: http://www.koehntopp.de/php/snippets.html#code-icq
  if (!is_numeric($uin)) return FALSE;

  $fp = @fsockopen('status.icq.com', 80, $errno, $errstr, 8);
  if (!$fp) return FALSE;

  $request = "HEAD /online.gif?icq=$uin&img=3 HTTP/1.0\r\n"
            ."Host: status.icq.com\r\n"
            ."Connection: close\r\n\r\n";
  fputs($fp, $request);

  do {
     $response = fgets($fp, 1024);
  }
  while (!feof($fp) && !stristr($response, 'Location'));

  fclose($fp);
  if (strstr($response, 'online1')) return 'online';
  if (strstr($response, 'online0')) return 'offline';
  if (strstr($response, 'online2')) return 'disabled';
  return FALSE;
}
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline universal

  • Full Member
  • ***
  • Posts: 213
    • View Profile
    • http://www.funny.lt
Re: Why I`ve never saw (<b>{user_icq_status}</b>) thing working?
« Reply #3 on: April 22, 2005, 07:55:46 AM »
thanks ;)
Again this addres?!
http://www.funny.lt

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: Why I`ve never saw (<b>{user_icq_status}</b>) thing working?
« Reply #4 on: April 24, 2005, 09:37:26 PM »
Nice, I just tried that out... and changed only a little bit:

this
Code: [Select]
  if (strstr($response, 'online1')) return 'online';
  if (strstr($response, 'online0')) return 'offline';
  if (strstr($response, 'online2')) return 'disabled';

to this
Code: [Select]
  if (strstr($response, 'online1')) return '<img src="templates/default/images/online.gif" width="14" height="14" border="0" alt="online" title="online">';
  if (strstr($response, 'online0')) return '<img src="templates/default/images/offline.gif" width="14" height="14" border="0" alt="offline" title="offline">';
  if (strstr($response, 'online2')) return '<img src="templates/default/images/disabled.gif" width="14" height="14" border="0" alt="disable" title="disabled">';

and I did use these images:

online:
offline:
disabled:

 :)

Thank you V@no
MAяTRIX


Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Why I`ve never saw (<b>{user_icq_status}</b>) thing working?
« Reply #5 on: April 24, 2005, 09:52:50 PM »
you are right...that's the only three lines could be changed...for some reason it didnt work when I tested it..:?
I'd suggest u dont use it that way, leave them as
Code: [Select]
  if (strstr($response, 'online1')) return 'online';
  if (strstr($response, 'online0')) return 'offline';
  if (strstr($response, 'online2')) return 'disabled';
and then in the template use:
Code: [Select]
<img src="templates/default/images/{user_icq_status}.gif" width="14" height="14" border="0" alt="{user_icq_status}" title="{user_icq_status}">I belive this is more practical ;)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: Why I`ve never saw (<b>{user_icq_status}</b>) thing working?
« Reply #6 on: April 24, 2005, 10:16:59 PM »
right  :D that's a very elegant way, how to do it... one will never learn out...  :lol:
MAяTRIX


Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: Why I`ve never saw (<b>{user_icq_status}</b>) thing working?
« Reply #7 on: June 05, 2006, 06:09:26 PM »
Just found out, that ICQ must have changed the internet pages, so the detail-link shows you an error page instead of the user's ICQ-detail...

Change

Code: [Select]
http://wwp.icq.com/scripts/search.dll?to=
into

Code: [Select]
http://www.icq.com/people/about_me.php?uin=
everywhere you find it in the code and templates and it will work again.

Have fun
MAяTRIX


Offline mawenzi

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Why I`ve never saw (<b>{user_icq_status}</b>) thing working?
« Reply #8 on: June 28, 2006, 05:52:23 PM »
... everywhere ...

Do you have a complete file list ? I would not like to look for so much ...  :wink:

- details.php
- member.php
- ... ?
« Last Edit: June 28, 2006, 06:07:19 PM by mawenzi »
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: Why I`ve never saw (<b>{user_icq_status}</b>) thing working?
« Reply #9 on: June 28, 2006, 10:30:55 PM »
No, I do not. Sorry.
I just use a file search like:

search for: *.php *.htm *.html

find text: wwp.icq

(in Norton Commander, Total Commander, Windows Commander, Salamander etc.)
MAяTRIX