Previous Thread
Next Thread
Print Thread
Rating: 5
Joined: Mar 2004
Posts: 3
Lurker
Lurker
Offline
Joined: Mar 2004
Posts: 3
Mod Name / Version: Show Unregistered Hostnames

Description: Shows the hostname of anonymous users on the "Who's Online" screen under the IP.

For example under 64.68.86.38 will show crawler2.googlebot.com

Working Under: UBB.Threads 6.3

Mod Status: Finished

Any pre-requisites:

Author(s): juggaleaux

Date: 04/16/04

Credits:

Files Altered: online.php
/templates/default/online.tmpl

New Files: none

Database Altered: none

Info/Instructions: a demo is here

In online.php, find this:

if ($user['U_Status'] == "Administrator") {
$piece['0'] = "";
preg_match("/-ANON-(.*)/",$Username,$piece);
$Username = $piece['1'];
}

and change to this:

if ($user['U_Status'] == "Administrator") {
$piece['0'] = "";
preg_match("/-ANON-(.*)/",$Username,$piece);
$Username = $piece['1'];
$hostname = gethostbyaddr($piece['1']);
$anonrow[$x]['hostname'] = $hostname;
}

In online.tmpl find this:

<td class="{$anonrow[$i]['color']}">
{$anonrow[$i]['Username']}
</td>

and change it to this:

<td class="{$anonrow[$i]['color']}">
{$anonrow[$i]['Username']}<BR>
<small>{$anonrow[$i]['hostname']}</small>
</td>

I've only tested this on 6.3, but it should work on some other versions as well.

Disclaimer: Please backup every file that you intend to modify.
If the modification modifies the database, it's a good idea to backup your database before doing so.

Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.

Sponsored Links
Joined: Oct 2003
Posts: 2,305
Old Hand
Old Hand
Joined: Oct 2003
Posts: 2,305
thanx

Joined: Jun 2000
Posts: 190
Enthusiast
Enthusiast
Joined: Jun 2000
Posts: 190
Works well in 6.4.1, although the default code is a bit different in the online.tmpl file than what it is in 6.3.

Thanks!


Artificial Intelligence is no match for natural stupidity!
Joined: Jan 2002
Posts: 674
Junior Member
Junior Member
Offline
Joined: Jan 2002
Posts: 674
It works but I get this at top of screen
6.4.1

Warning: gethostbyaddr(): Address is not a valid IPv4 or IPv6 address in /home/steelhea/public_html/ubbthreads/online.php on line 266

Warning: gethostbyaddr(): Address is not a valid IPv4 or IPv6 address in /home/steelhea/public_html/ubbthreads/online.php on line 266

Warning: gethostbyaddr(): Address is not a valid IPv4 or IPv6 address in /home/steelhea/public_html/ubbthreads/online.php on line 266

Warning: gethostbyaddr(): Address is not a valid IPv4 or IPv6 address in /home/steelhea/public_html/ubbthreads/online.php on line 266

Warning: gethostbyaddr(): Address is not a valid IPv4 or IPv6 address in /home/steelhea/public_html/ubbthreads/online.php on line 266

Warning: gethostbyaddr(): Address is not a valid IPv4 or IPv6 address in /home/steelhea/public_html/ubbthreads/online.php on line 266

Joined: Oct 2003
Posts: 2,305
Old Hand
Old Hand
Joined: Oct 2003
Posts: 2,305
add a @ before the gethostbyaddr so php doesn't broadcast it

Sponsored Links
Joined: Jan 2002
Posts: 674
Junior Member
Junior Member
Offline
Joined: Jan 2002
Posts: 674
thanks

Joined: Jan 2003
Posts: 338
Enthusiast
Enthusiast
Offline
Joined: Jan 2003
Posts: 338
Cool, great thx k:

Joined: Sep 2003
Posts: 803
Coder
Coder
Offline
Joined: Sep 2003
Posts: 803
would this work for 6.4.2? nice addon

Joined: Mar 2004
Posts: 118
Journeyman
Journeyman
Offline
Joined: Mar 2004
Posts: 118
It should work with a little workarround

I have a question: is there a way to speed gethostbyaddr somehow?
With DNS cach information perhaps?

My whosonline takes for about 50sec with aprox. 50-70 users online


Kind regards,
PaNTerSan
Joined: Mar 2004
Posts: 3
Lurker
Lurker
Offline
Joined: Mar 2004
Posts: 3
Another idea to improve on this would be to add an option in the preferences in the admin panel.

Who's Online Settings
( ) Show IP addresses only
( ) Show hostnames only
( ) Show IP & hostnames

If someone could pull that off, that could be added to the core install. It doesn't take a whole lot of code, and it's not too obtrusive.

Sponsored Links
Joined: Mar 2004
Posts: 118
Journeyman
Journeyman
Offline
Joined: Mar 2004
Posts: 118
[]PaNTerSan said:
I have a question: is there a way to speed gethostbyaddr somehow?
My whosonline takes for about 50sec with aprox. 50-70 users online [/]
I've copied online.php to resolve.php and also the template files, made changes for @gethostbyaddr. Then I added another $adminlink in ubbt.inc.php - so now admins have Resolve and Who's online possibilites. Both serving their purpose


Kind regards,
PaNTerSan
Joined: Dec 2003
Posts: 2
Lurker
Lurker
Offline
Joined: Dec 2003
Posts: 2
We had this running on 6.4. We upgraded recently to 6.5(b1) and I'm glad to say its still fully functional

Joined: Sep 2003
Posts: 803
Coder
Coder
Offline
Joined: Sep 2003
Posts: 803
im on a new install of 6.5b1 and the directions worked as stated...

Joined: Dec 2004
Posts: 20
Newbie
Newbie
Offline
Joined: Dec 2004
Posts: 20
can you make this so mods and admin can see the host name?

Joined: Sep 2003
Posts: 488
Code Monkey
Code Monkey
Joined: Sep 2003
Posts: 488
Easy-peasy, just change the first step above to this instead...

In online.php, find this:

if ($user['U_Status'] == "Administrator") {
$piece['0'] = "";
preg_match("/-ANON-(.*)/",$Username,$piece);
$Username = $piece['1'];
}

and change to this:

if (($user['U_Status'] == "Moderator") || ($user['U_Status'] == "Administrator") ) {
$piece['0'] = "";
preg_match("/-ANON-(.*)/",$Username,$piece);
$Username = $piece['1'];
$hostname = gethostbyaddr($piece['1']);
$anonrow[$x]['hostname'] = $hostname;
}

Joined: Jul 2002
Posts: 79
Power User
Power User
Offline
Joined: Jul 2002
Posts: 79
FWIW this works well in 6.5

Joined: Apr 2003
Posts: 359
Enthusiast
Enthusiast
Joined: Apr 2003
Posts: 359
Installed with v6.5 with no problem-o!

Thanks for sharing this code.

Joined: Apr 2003
Posts: 359
Enthusiast
Enthusiast
Joined: Apr 2003
Posts: 359
Also, working under v6.5.1.1 without hitches.

The code to replace is the same.

You can update the hack to show that it works up to v6.5.1.1

Joined: Dec 2002
Posts: 4
Lurker
Lurker
Offline
Joined: Dec 2002
Posts: 4
[]Twisty said:
Easy-peasy, just change the first step above to this instead...

In online.php, find this:

if ($user['U_Status'] == "Administrator") {
$piece['0'] = "";
preg_match("/-ANON-(.*)/",$Username,$piece);
$Username = $piece['1'];
}

and change to this:

if (($user['U_Status'] == "Moderator") || ($user['U_Status'] == "Administrator") ) {
$piece['0'] = "";
preg_match("/-ANON-(.*)/",$Username,$piece);
$Username = $piece['1'];
$hostname = gethostbyaddr($piece['1']);
$anonrow[$x]['hostname'] = $hostname;
} [/]

If You make some changes this for registered users, it will be great


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)