UBB.Dev
Posted By: Gizmo [7.0-7.2.x] Admin IP Information - 11/12/2006 3:13 AM
In .T7 we have the option of having it so the admins (or admins and mods) can see the IP address of a user; through a feature request of Joe Siegler I pieced together a quick modification that will link the displayed IP Address of the user to the address whois on Domain Tools which will provide the admin (or mod) to view where the IP is located, who the ISP is, if its blacklisted, and show what the reverse address search is...

For 7.3+ please see this modification.

There isn't really a demo (as you can't see ip's on my site unless you're an admin/mod), but you can see how the DomainTools.com IP listing looks here.

Posts View:
In scripts/showflat.inc.php:
Find:
Code
		if ( ($config['SHOW_POSTER_IP'] == 1) && $IP) {
$postrow[$i]['IP'] = "($IP)";
}

elseif ( ($config['SHOW_POSTER_IP'] == 2) && ( ($user['USER_MEMBERSHIP_LEVEL'] == "Administrator") || ($ismod=='yes') ) && ($IP) ) {
$postrow[$i]['IP'] = "($IP)";
}
elseif ( ($config['SHOW_POSTER_IP'] == 3) && ($user['USER_MEMBERSHIP_LEVEL'] == "Administrator") && ($IP) ) {
$postrow[$i]['IP'] = "($IP)";
}
else {
$postrow[$i]['IP'] = "";
}

Replace With:
Code
		if ( ($config['SHOW_POSTER_IP'] == 1) && $IP) {
$postrow[$i]['IP'] = "$IP";
}

elseif ( ($config['SHOW_POSTER_IP'] == 2) && ( ($user['USER_MEMBERSHIP_LEVEL'] == "Administrator") || ($ismod=='yes') ) && ($IP) ) {
$postrow[$i]['IP'] = "$IP";
}
elseif ( ($config['SHOW_POSTER_IP'] == 3) && ($user['USER_MEMBERSHIP_LEVEL'] == "Administrator") && ($IP) ) {
$postrow[$i]['IP'] = "$IP";
}
else {
$postrow[$i]['IP'] = "";
}


In scripts/showthreaded.inc.php:
Find:
Code
	if ( ($config['SHOW_POSTER_IP'] == 1) && $IP) {
$IP = "($IP)";
}
elseif ( ($config['SHOW_POSTER_IP'] == 2) && ( ($user['USER_MEMBERSHIP_LEVEL'] == "Administrator") || ($ismod == 'yes') ) && ($IP) ) {
$IP = "($IP)";
}
elseif ( ($config['SHOW_POSTER_IP'] == 3) && ($user['USER_MEMBERSHIP_LEVEL'] == "Administrator") && ($IP) ) {
$IP = "($IP)";
}
else {
$IP = "";
}

Replace With:
Code
	if ( ($config['SHOW_POSTER_IP'] == 1) && $IP) {
$IP = "$IP";
}
elseif ( ($config['SHOW_POSTER_IP'] == 2) && ( ($user['USER_MEMBERSHIP_LEVEL'] == "Administrator") || ($ismod == 'yes') ) && ($IP) ) {
$IP = "$IP";
}
elseif ( ($config['SHOW_POSTER_IP'] == 3) && ($user['USER_MEMBERSHIP_LEVEL'] == "Administrator") && ($IP) ) {
$IP = "$IP";
}
else {
$IP = "";
}

In templates/showflat.tpl:
Find:
Code
{if $postrow[post].IP}
<br />
<i>{$postrow[post].IP}</i>
{/if}

Replace With:
Code
{if $postrow[post].IP}
<br />
<i>(<a href="http://whois.domaintools.com/{$postrow[post].IP}" target="_blank">{$postrow[post].IP}</a>)</i>
{/if}

In templates/showthreaded.tpl:
Find:
Code
{if $IP}
<br />
<i>{$IP}</i>
{/if}

Replace With:
Code
{if $IP}
<br />
<i>(<a href="http://whois.domaintools.com/{$postrow[post].IP}" target="_blank">{$postrow[post].IP}</a>)</i>
{/if}



Who's Online:
In templates/online.tpl:
Find:
Code
{$regrow[user].IP}

Replace With:
Code
(<a href="http://whois.domaintools.com/{$regrow[user].IP}" target="_blank">{$regrow[user].IP}</a>)

Find:
Code
{$anonrow[user].IP}

Replace With:
Code
(<a href="http://whois.domaintools.com/{$anonrow[user].IP}" target="_blank">{$anonrow[user].IP}</a>)

Find:
Code
{$botrow[user].IP}

Replace With:
Code
(<a href="http://whois.domaintools.com/{$botrow[user].IP}" target="_blank">{$botrow[user].IP}</a>)



Admin User View:
In templates/default/admin/showuser.tmpl:
Find:
Code
$regip

Replace With:
Code
(<a href="http://whois.domaintools.com/$regip" target="_blank">$regip</a>)

Find:
Code
$lastpostip

Replace With:
Code
(<a href="http://whois.domaintools.com/$lastpostip" target="_blank">$lastpostip</a>)

You can change the search engine you use (should you have one you prefer, such as the one at www.dollardns.net which is the original one I tested this on) you can just edit the domain line in /templates/showflat.tpl and /templates/showthreaded.tpl

7.2 Notice: If installing in 7.2, apply the showflat/showthreaded steps to post_side.tpl and post_top.tpl
Posted By: AllenAyres Re: Admin IP Information - 11/12/2006 5:29 AM
Nice, thank you Gizzy smile
Posted By: Gizmo Re: Admin IP Information - 11/12/2006 10:13 AM
Yes, I made a use for the ip listing lol... it just seemed so lonely sitting there as a number, i wanted the ability to click it lol...

I should put a blank location in the link code...
Posted By: Gizmo Re: Admin IP Information - 11/12/2006 10:15 AM
there, updated the code block to add in a target location of a blank window; if you don't want it to go to a blank window, simply remove the target="_blank" from the link code in the last step.
Posted By: Harold Re: Admin IP Information - 11/15/2006 3:47 PM
I wonder how this will work with the new online features being added with version 7.1? I haven't installed any real hacks yet and this would be one of the first ones along with several others that I would place in the "must haves" category.
Posted By: Gizmo Re: Admin IP Information - 11/16/2006 12:35 AM
'eh I'll make something compatable when the time comes (should it not be compatable), even if i have to add that magnifying glass icon with a link for the ip information wink...
Posted By: jgeoff Re: Admin IP Information - 12/02/2006 11:06 PM

Here are some additions to Gizzy's mod (you need to implement his first before adding these):


TO HYPERLINK IP ADDRESSES IN ADMIN VIEW OF A USER'S PROFILE

EDIT: /templates/default/admin/showuser.tmpl

On or near Line 88:

CHANGE:
Code

$regdate - $regip
TO:
Code

$regdate - <a href="http://whois.domaintools.com/$regip" target="_blank">$regip</a>

AND on or near Line 96:

CHANGE:
Code

$lastpost - $lastpostip
TO:
Code

$lastpost - <a href="http://whois.domaintools.com/$lastpostip" target="_blank">$lastpostip</a>


TO HYPERLINK IP ADDRESSES IN WHO'S ONLINE


EDIT: /templates/default/online.tpl

On or near Line 36:

CHANGE:
Code

<span class="small">{$regrow[user].IP}</span>
TO:
Code

<span class="small"><a href="http://whois.domaintools.com/{$regrow[user].IP}" target="_blank">{$regrow[user].IP}</a></span>

AND on or near Line 82:

CHANGE:
Code

{$anonrow[user].Username}
TO:
Code

<a href="http://whois.domaintools.com/{$anonrow[user].Username}" target="_blank">{$anonrow[user].Username}</a>

/jg
Posted By: Ohton Re: Admin IP Information - 01/25/2007 2:48 PM
I am not sure I understand, gizmo's code in find is the same as window to replace?

and i can't see the code in the last window from another post.
Posted By: Stephen G Re: Admin IP Information - 01/25/2007 7:49 PM
I got it to work by editing in `showflat.inc.php` and `showflat.tpl` but couldn't find the same code in `showthreaded.inc.php` or `showthreaded.tpl` (no biggie for me as I view in `flat` not `thread`).

Would love to add jgeoff`s additions but can't see the altered code either.
Posted By: Gizmo Re: Admin IP Information - 01/25/2007 10:35 PM
Yeh some files changed; i'll update this over the weekend
Posted By: Gizmo Re: Admin IP Information - 03/08/2007 11:24 PM
Updated initial post with changes in 7.1 (for 7.0 users, simply ignore the search engines section of online.tpl). Also incorporated jgeoff's additions.
Posted By: jgeoff Re: Admin IP Information - 03/18/2007 1:45 AM

Giz, what would these be changed to in membersearch.tmpl?
Code

<i>{$ubbt_lang['LAST_IP']}</i>   {$result[$i]['lastpostip']}

<i>{$ubbt_lang['REG_IP']}</i>   {$result[$i]['regip']}
I'm afraid to play with those for some reason... laugh
Posted By: Gizmo Re: Admin IP Information - 03/18/2007 1:55 AM
In membersearch.tmpl
Find:
Code
<i>{$ubbt_lang['LAST_IP']}</i>   {$result[$i]['lastpostip']}

And:
Code
<i>{$ubbt_lang['REG_IP']}</i>   {$result[$i]['regip']}

Replace with:
Code
<i>{$ubbt_lang['LAST_IP']}</i>   <a href="http://whois.domaintools.com/{$result[$i]['lastpostip']}" target="_blank">{$result[$i]['lastpostip']}</a>

And:
Code
<i>{$ubbt_lang['REG_IP']}</i>   <a href="http://whois.domaintools.com/{$result[$i]['regip']}" target="_blank">{$result[$i]['regip']}</a>
Posted By: jgeoff Re: Admin IP Information - 03/18/2007 2:17 AM

Not so bad... great, thanks! cool

Posted By: cclapper Re: Admin IP Information - 05/20/2007 12:33 PM
DomainTools have nice API which could be connected with this feature. Altough, they have some limitation. After certain number of queries you have to start paying frown
Posted By: Gizmo Re: Admin IP Information - 05/20/2007 1:15 PM
It'd be ok as a seperate modification; this one allows users to use any number of free services that are readily available.
Posted By: Gizmo Re: Admin IP Information - 07/17/2007 5:06 AM
Updated initial post with:
Originally Posted by Gizmo
7.2 Notice: If installing in 7.2, apply the showflat/showthreaded steps to post_side.tpl and post_top.tpl
Posted By: Mike G Re: [7.x] Admin IP Information - 07/22/2007 2:15 AM
Hi, not sure how to include Moderators in the ability to lookup IP info.

( ($user['USER_MEMBERSHIP_LEVEL'] == "Administrator")

Not super proficient with PHP so I don't know the proper method to specify more than one membership level.
Posted By: Gizmo Re: [7.x] Admin IP Information - 07/22/2007 4:02 AM
Going to drop the beginning ( from your post and work only with the "guts".

As this allows only the admin:
($user['USER_MEMBERSHIP_LEVEL'] == "Administrator")

This SHOULD allow both an admin and a mod.
(($user['USER_MEMBERSHIP_LEVEL'] == "Administrator") || ($user['USER_MEMBERSHIP_LEVEL'] == "Moderator"))
Posted By: Mike G Re: [7.x] Admin IP Information - 07/22/2007 4:20 AM
Thanks Gizmo, that did the trick!

Posted By: Rose Re: [7.x] Admin IP Information - 07/23/2007 3:37 AM
I'm very confused. Giz, is your first script up-to-date with all the changes in the rest of the thread?

Thanks, I'd like to apply this mod. smile
Posted By: Mike G Re: [7.x] Admin IP Information - 07/23/2007 7:21 AM
Originally Posted by Rose
I'm very confused. Giz, is your first script up-to-date with all the changes in the rest of the thread?

Thanks, I'd like to apply this mod. smile

Hi Rose,

I took Gizmo's online "how to" and updated it for v7.2 and put it into an attachment. Also incorporated the Admin/Mod update he helped me with the other night. Just take a look at the attachment, it is commented for that section. As is it will allow both Admins and Mod's to view IP details.

[Gizmo, Mod's... feel free to relocate this attachment to the inital post if you wish]




Attached File
2453-AdminIPInfo7.2.txt  (23 downloads)
Posted By: Gizmo Re: [7.x] Admin IP Information - 07/23/2007 9:33 AM
It shouldn't be too much differant in 7.2; granted the showflat/showthreaded steps apply elsewhere, but i commented on that in the original post... I'm not sure what all would be differant; it's honestly just looking for the ip areas, I applied this on my sites but i'm not sure how much of the "how to" i actually followed in 7.2...
Posted By: Mike G Re: [7.x] Admin IP Information - 07/23/2007 5:04 PM
Originally Posted by Gizmo
It shouldn't be too much differant in 7.2; granted the showflat/showthreaded steps apply elsewhere, but i commented on that in the original post... I'm not sure what all would be differant; it's honestly just looking for the ip areas, I applied this on my sites but i'm not sure how much of the "how to" i actually followed in 7.2...

Just minor things, like path to the template files (added the /default/ path) removing the reference to showthreaded since it dosesn't exist (at least on my v7.2 installation) and included the blurb on Admin & Mod permissions.

I like having the mod's in a text file as well since I can store that information for future reference.

Posted By: Rose Re: [7.x] Admin IP Information - 07/23/2007 6:21 PM
Thanks Mike and Gizmo! smile
Posted By: winter Re: [7.x] Admin IP Information - 06/24/2008 9:11 PM
This is very nice, and is something I wish was included in the standard code. We always check a new members IP# (and their email address via Google) to see what info turns up before we approve them.

Do you know if it is possible to do this with some other DNS sites? For instance the site http://www.ipligence.com/geolocation/# is sort of nice because it provides a map of the location (as do several other sites). But it looks like the IP# info is generated once you enter the number in their form and submit it. Is there anyway to do that with something like what the modifications listed here?

Mark
Posted By: Gizmo Re: [7.x] Admin IP Information - 06/25/2008 2:18 AM
So long as they allow input via the URL youc an use anyone; simply change the default url in your install.
Posted By: winter Re: [7.x] Admin IP Information - 06/25/2008 4:47 PM
Thanks for responding Gizmo. I think the problem is that they don't allow input via the URL. Most of these sites return the IP informtion for the person who is accessing the page. So in the case of ipligence.come (and several others)if I put their URL in then when an Admin clicks on a users IP# they get information about themselves instead of info for the user.

The sites are set up with a form where you have to type in the ip# you want info on if you are not inquiring about your own IP. I don't know if it is possible to setup a URL which will pass the ip number to the form and submit it? That is what I was hoping was possible, but I suspect it is not.

Not a big deal, but the tie in to Google maps is helpful to get a sense of where they are.

Anyway, thanks again,
Mark
Posted By: Gizmo Re: [7.x] Admin IP Information - 06/26/2008 3:14 AM
Well, it'd be a little more involved than that... Those which allow input via URL use the GET input, wheres others use POST which would require them allowing outside input in the first place...
Posted By: jgeoff Re: [7.x] Admin IP Information - 03/17/2009 10:53 PM

JEEZ! The delete time is pretty short here, no? tipsy
(I mistakingly posted this under 7.0-7.2 rather than 7.3)




My linked IP addresses are no longer working because they come through as being enclosed in parentheses and -- while it used to work just fine for domaintools.com, they no longer do.

Am I missing something here that causes IPs to be enclosed in parentheses? I've been away from this code for so long -- did I put the parentheses somewhere else? lol

in my post_side.tpl

Code

{if $postrow[post].IP}
<br />
<i><a href="http://whois.domaintools.com/{$postrow[post].IP}" target="_blank">{$postrow[post].IP}</a></i>
{/if}

My results now turned up malformed, despite them working fine recently (with parentheses; domaintools didn't care before):

http://whois.domaintools.com/(206.16.96.32)


Posted By: Gizmo Re: [7.x] Admin IP Information - 03/18/2009 12:28 AM
The initial steps in the main page should have nuked the parenthases in the first place... (in fact, thats all the script page update does)
© UBB.Developers