******************************************************************************
******************************************************************************
* Mod Name: Advanced IP Logging *
******************************************************************************
* Description: Adds new IP logging feature to your board. *
* It also adds Recent Activities section with date/time/IP *
* to member profiles. *
* Adds "View User IP History" link to users profiles *
* (admins only, Control Panel). *
* Adds a new search option to the Extended Search Options in *
* the UBB Control Panel (User IP History). *
******************************************************************************
* Updates: v1.2 - *
* Minor code changes and a bug fix. *
* *
* v1.2.1 - *
* Code cleanup. *
* *
* v1.2.2 - *
* MultiHack support. Ported to v6.2 and v6.3 series. *
* "N/A" displayed instead of nothing if no IP has been *
* recorded for someone (profile only). *
* *
* v1.2.3 - *
* More code cleanup. IP recorded on initial login (right *
* after registration). *
* *
* v2.0 - *
* New features and changes include: *
* IPs are only logged if they are "unique". That is, if *
* haven't been logged for that user before. *
* It is possible to search user IP history from the control *
* panel (View/Edit Member Records - Extended Search Options)*
* *
* v2.0.1 - *
* Bug fix: Directory created if it doesn't exist. *
* Only administrators are allowed to view the *
* "Recent Activities" part of member profiles. *
* *
* v2.0.2 - *
* Bug fix: Directory created if it doesn't exist. *
* Only administrators are allowed to view the *
* "Recent Activities" part of member profiles. *
******************************************************************************
* By: Idle *
* Email: [email protected] *
* Date: Nov 10th, 2003 *
* Version: 2.0.2 *
******************************************************************************
* Requirements: 6.5.0 Beta Release 1 or newer. *
* Compatability: 6.5.x *
* Tested On: 6.5.0 Beta Release 1 and 6.3.0.3 *
******************************************************************************
* Files Modified: ultimatebb.cgi, ubb_profile.cgi, cp.cgi, *
* ubb_registration.cgi, ubb_new_reply.cgi, *
* ubb_new_topic.cgi, cp_users.cgi *
* *
* Templates: public_display_profile.pl, cp_edit_profile.pl, *
* cp_user_search_form.pl, cp_user_search_results.pl *
* cp_new_members.pl *
* *
* New Files: ubb_lib_idle.cgi, cp_user_ips.pl *
******************************************************************************
******************************************************************************
* Disclaimer: By using this mod, the user implicitly agrees that they *
* are willingly modifying any and all files at their own *
* risk. Should any errors occur either as a direct or *
* indirect result of said modifications the user agrees not *
* to hold Infopop Corporation or any of the individuals *
* listed above accountable. *
* *
* *
* In Other Words: Please make backup copies of every file you plan to *
* modify prior to modification! *
* *
* *
* For more tips and tricks for use with the Ultimate Bulletin Board *
* please visit us at: *
* *
* https://ubbdev.com *
* *
******************************************************************************
******************************************************************************
========================================
In ultimatebb.cgi Find:
========================================
chomp($mod_q);
#6.1.0 - now forbidding login without queue approval
========================================
BELOW that paste:
========================================
#append to IP log
&RequireCode("$vars_config{CGIPath}/ubb_lib_idle.cgi");
&AppendIPLog($profile_number);
========================================
In ubb_registration.cgi Find:
========================================
$username = $user_name;
print header(
-cookie => [$cookie],
-charset => "$masterCharset",
-type => "text/html",
);
========================================
BELOW that paste:
========================================
#append to IP log
&RequireCode("$vars_config{CGIPath}/ubb_lib_idle.cgi");
&AppendIPLog($next_number);
========================================
In ubb_profile.cgi Find:
========================================
sub get_profile {
local (@user_profile, $user_public_name, $user_status, $count, $chompee, $date_registered, $reg_month, $reg_day, $reg_year, @themonths, @viewer_profile, $is_admin_mod, $u, $rating_line, $overall_rating, $admin_view_rating, %user, $personal_line, $personal_rating, $user_ratings_off, %votes, %totals, %avg, %weighted_avg, $pm_line, %pm_ignore, %pm_buddy, $total_votes, $add_2_list);
========================================
BELOW that paste:
========================================
local (@mylast, $is_admin);
========================================
In ubb_profile.cgi Find:
========================================
# viewing your own record.. if so, can't rate yourself
========================================
ADD above:
========================================
if ($viewer_profile[8] eq 'Administrator') {
$is_admin = 'true';
} else {
$is_admin = 'false';
}
========================================
In ubb_profile.cgi Find:
========================================
} # end pm check
if ($rating_line eq '') { $rating_line = ' '; }
========================================
BELOW that paste:
========================================
# retrieve last login stuff
&RequireCode("$vars_config{CGIPath}/ubb_lib_idle.cgi");
&GetLastLoginInfo("$in{u}");
========================================
In cp.cgi Find:
========================================
if (($ubb eq 'user_posts') && ($status eq 'Administrator')) {
&RequireCode("$vars_config{CGIPath}/cp_users.cgi");
&recent_user_posts_for_admin;
exit(0);
} #end user_settings
========================================
BELOW that paste:
========================================
if (($ubb eq 'user_ips') && ($status eq 'Administrator')) {
&RequireCode("$vars_config{CGIPath}/ubb_lib_idle.cgi");
&recent_user_ips_for_admin;
exit(0);
} #end user_ips
========================================
In ubb_new_reply.cgi Find:
========================================
&WriteMemberProfile($user_number, @user_profile);
# Now update the user posts file
&AppendFileAsString("$vars_config{MembersPath}/user_posts/$user_number.cgi", "$GotTime{YMDRunonDate}|$in{f}|$in{t}|$post_number|$ipaddyn");
} # end update user profile
========================================
BELOW that paste:
========================================
#append to IP log
&RequireCode("$vars_config{CGIPath}/ubb_lib_idle.cgi");
&AppendIPLog($user_number);
========================================
In ubb_new_topic.cgi Find:
========================================
&WriteMemberProfile($user_number, @user_profile);
# Now update the user posts file
&AppendFileAsString("$vars_config{MembersPath}/user_posts/$user_number.cgi", "$GotTime{YMDRunonDate}|$in{f}|$new_topic_number|000000|$ipaddyn");
} # end update user profile
========================================
BELOW that paste:
========================================
#append to IP log
&RequireCode("$vars_config{CGIPath}/ubb_lib_idle.cgi");
&AppendIPLog($user_number);
========================================
In cp_users.cgi Find:
========================================
$searchparams{'regip'} = $in{'regip'};
========================================
BELOW that paste:
========================================
$searchparams{'loggedip'} = $in{'loggedip'};
========================================
In cp_users.cgi Find:
========================================
if (($params{'canwrite'} eq "") && #if none of the extended options
($params{'privforum'} eq "") && #are selected, just go straight to the results screen
($searchparams{'posts'} eq "") && ($searchparams{'status'} eq "") &&
($searchparams{'permiss'} eq "") && ($searchparams{'lastpost'} eq "") &&
($searchparams{'regdate'} eq "") &&
($params{'bdaymath'} eq "") && ($searchparams{'regip'} eq "") &&
($searchparams{'lpostip'} eq "") && ($searchparams{'pemail'} eq "") &&
($searchparams{'nobday'} eq "") && ($searchparams{'currentposts'} !~ m/^(yes|no)$/)
)
{
$searchparams{'skipprocess'} = 1; # if $searchparams{'number'} =~ m/^d{1,}$/;
}
========================================
REPLACE with:
========================================
#if none of the extended options (other than email) are selected, just go straight to the results screen
if (($params{'canwrite'} eq "") &&
($params{'privforum'} eq "") &&
($searchparams{'posts'} eq "") && ($searchparams{'status'} eq "") &&
($searchparams{'permiss'} eq "") && ($searchparams{'lastpost'} eq "") &&
($searchparams{'dname'} eq "") && ($searchparams{'regdate'} eq "") &&
($params{'bdaymath'} eq "") && ($searchparams{'regip'} eq "") &&
($searchparams{'lpostip'} eq "") && ($searchparams{'pemail'} eq "") &&
($searchparams{'loggedip'} eq "") && ($searchparams{'pemail'} eq "") &&
($searchparams{'nobday'} eq "") && ($searchparams{'currentposts'} !~ m/^(yes|no)$/)
)
{
$searchparams{'skipprocess'} = 1; # if $searchparams{'number'} =~ m/^d{1,}$/;
}
========================================
In cp_users.cgi Find:
========================================
if ($searchparams{'pemail'} ne "") { #print "10";
next CHECKER unless exists $memberslist{$user};
my $returned = &SearchForEmail($profile[9]);
&CheckReturn($returned, $user);
}
========================================
BELOW that paste:
========================================
if ($searchparams{'loggedip'} ne "") { #print "11";
next CHECKER unless exists $memberslist{$user};
my $userips = &OpenFileAsHash("$vars_config{MembersPath}/user_ips/$user.cgi", "|");
my $returned = &SearchIPHistory($userips, $searchparams{'loggedip'});
&CheckReturn($returned, $user);
}
========================================
In cp_users.cgi Find:
========================================
sub SearchForIP {
my $field = shift;
my $what = shift;
my $match = 2;
# Don't match invalid IPs
return $match unless $field =~ m/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/;
return $match unless $what =~ m/^[d.\]+$/;
return 1 if $field =~ m/$what/;
return $match;
}
========================================
BELOW that paste:
========================================
sub SearchIPHistory {
my $iplist = shift;
my $what = shift;
my $match = 2;
my %iplist = %$iplist;
$crap = $what; # 128.110.34.27
$crap =~ s/\//g; # 128.110.34.27
# Don't match invalid IPs
return $match unless $crap =~ m/^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/;
return 1 if exists($iplist{"$crap"});
return $match;
}
========================================
In public_display_profile.pl Find:
========================================
extra_info
========================================
ADD above:
========================================
$TBB
========================================
In public_display_profile.pl Find (same as above):
========================================
extra_info
========================================
ADD below:
========================================
if ($is_admin eq 'true') {
print <<recent_stuff;
$TBT
<tr bgcolor="$vars_style{TableColorStrip}">
<td colspan="2">
<font size="$vars_style{TextSize}" color="$vars_style{TableStripTextColor}" face="$vars_style{FontFace}">
<b>Recent Activities (Administrators Only)</b>:
</font>
</td>
</tr>
<tr bgcolor="$vars_style{AltColumnColor1}">
<td colspan="2">
<font size="$vars_style{TextSize}" face="$vars_style{FontFace}">
<b>Date/Time</b>: $mylast[1]
</font>
</td>
</tr>
<tr bgcolor="$vars_style{AltColumnColor1}">
<td colspan="2">
<font size="$vars_style{TextSize}" face="$vars_style{FontFace}">
<b>IP</b>: $mylast[0]
</font>
</td>
</tr>
recent_stuff
}
========================================
In cp_edit_profile.pl Find:
========================================
| <a href="$vars_config{CGIURL}/cp.cgi?ubb=user_posts&u=$in{u}">$vars_wordlets_cp{edit_profile_user_posts}</a>
========================================
Replace with:
========================================
| <a href="$vars_config{CGIURL}/cp.cgi?ubb=user_posts&u=$in{u}">$vars_wordlets_cp{edit_profile_user_posts}</a> | <a href="$vars_config{CGIURL}/cp.cgi?ubb=user_ips&u=$in{u}">View User IP History</a></B>
========================================
========================================
In cp_new_members.pl Find:
========================================
<td valign="bottom"><span class="autorow-description" style="font-weight: bold;">
$vars_wordlets_cp{newmembers_header_status}
</span></td>
========================================
BELOW that paste:
========================================
<td valign="bottom"><span class="autorow-description" style="font-weight: bold;">
IP History
</span></td>
========================================
In cp_new_members.pl Find:
========================================
<td class="autorow" style="border-left: 1px solid $vars_style_cp{AltBorderColor};"><span class="autorow-description">
$title
</span></td>
========================================
BELOW that paste:
========================================
<td class="autorow" style="border-left: 1px solid $vars_style_cp{AltBorderColor};"><span class="autorow-description">
<a href="$vars_config{CGIURL}/cp.cgi?ubb=user_ips&u=$un">View IP History</a>
</span></td>
========================================
In cp_user_search_form.pl Find:
========================================
<tr bgcolor="$vars_style_cp{AltColumnColorCurrent}">
<td class="autorow"><span class="autorow-title">
<label for="lpostip">$vars_wordlets_cp{memsearch_last_ip}</label></span>
<span class="autorow-description">
$vars_wordlets_cp{memsearch_last_ip_explained}
</span></td>
<td class="autorow"><span class="autorow-options">
<input type="text" size="15" maxlength="15" id="lpostip" name="lpostip" />
</span></td></tr>
========================================
BELOW that paste:
========================================
~; &AlternateColors; print qq~
<tr bgcolor="$vars_style_cp{AltColumnColorCurrent}">
<td class="autorow"><span class="autorow-title">
<label for="lpostip"><b>User IP Histories</b></label></span>
<span class="autorow-description">
This will search all logged IP addresses. This is an <b>exact</b> IP match, so you will need to supply
a complete and valid IP address for accurate results (<b>127.0.0.1</b>, but not <b>127.0</b>).
</span></td>
<td class="autorow"><span class="autorow-options">
<input type="text" size="15" maxlength="15" id="lpostip" name="lpostip" />
</span></td></tr>
========================================
In cp_user_search_results.pl Find:
========================================
<td valign="bottom" class="secondheaderrow" style="border-left: 1px solid $vars_style_cp{AltBorderColor};"><span class="autorow-options">
$vars_wordlets_cp{memsearch_results_header_stauts}
</span></td>
========================================
BELOW that paste:
========================================
<td valign="bottom" class="secondheaderrow" style="border-left: 1px solid $vars_style_cp{AltBorderColor};"><span class="autorow-options">
IP History
</span></td>
========================================
In cp_user_search_results.pl Find:
========================================
<td class="autorow" style="border-left: 1px solid $vars_style_cp{AltBorderColor};"><span class="autorow-description">
$title
$user_profile[31]
</span></td>
========================================
BELOW that paste:
========================================
<td class="autorow" style="border-left: 1px solid $vars_style_cp{AltBorderColor};"><span class="autorow-description">
<a href="$vars_config{CGIURL}/cp.cgi?ubb=user_ips&u=$match">View IP History</a>
</span></td>
========================================
If you're using JCTemplates, complete the next step as well.
===============================================================
In noncgi/Templates/JCTemplates/public_display_profile.pl Find:
===============================================================
extra_info
========================================
ADD above:
========================================
$TBB
===============================================================
In noncgi/Templates/JCTemplates/public_display_profile.pl Find (same as above):
===============================================================
extra_info
========================================
BELOW that paste:
========================================
if ($is_admin eq 'true') {
print <<recent_stuff
$TBT
<tr bgcolor="$vars_style{TableColorStrip}">
<td colspan="2" class="normal-font" background="$vars_config{NonCGIURL}/$vars_style{jc_title_bar}">Recent Activities (Administrators Only):</td>
<td background="$vars_config{NonCGIURL}/$vars_style{jc_title_bar}"> </td>
</tr>
<tr bgcolor="$vars_style{AltColumnColor1}">
<td colspan="2" class="normal-font" width="35%"><b>Date/Time</b>:</td>
<td colspan="2" class="normal-font" width="65%" align="left">$mylast[1]</td>
</tr>
<tr bgcolor="$vars_style{AltColumnColor1}">
<td colspan="2" class="normal-font" width="35%"><b>IP</b>:</td>
<td colspan="2" class="normal-font" width="65%" align="left">$mylast[0]</td>
</tr>
recent_stuff
}
========================================
UPLOAD all hacked files.
UPLOAD ubb_lib_idle.cgi to your CGI Directory and CHMOD to 755.
UPLOAD cp_user_ips.pl to your NonCGI/Templates directory.
Now clear your cache. Enjoy the hack! Any problems post in the hack thread:
https://ubbdev.com/ubb/ultimatebb.php?ubb=get_topic;f=31;t=000033