Couple of mods to template and addition of rdns lookup for IP

git-svn-id: file:///svn/phpbb/trunk@1009 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2001-09-07 23:42:26 +00:00
parent d51c14ea0a
commit 19ae53a5b1
3 changed files with 87 additions and 34 deletions

View file

@ -629,10 +629,12 @@ $lang['Topic_split'] = "The selected topic has been split successfully";
$lang['Too_many_error'] = "You have selected too many posts. You can only select one post to split a topic after!"; $lang['Too_many_error'] = "You have selected too many posts. You can only select one post to split a topic after!";
$lang['New_forum'] = "New forum"; $lang['New_forum'] = "New forum";
$lang['None_selected'] = "You have no selected any topics to preform this operation on. Please go back and select at least one."; $lang['None_selected'] = "You have no selected any topics to preform this operation on. Please go back and select at least one.";
$lang['IP_on_this_post'] = "IP for this post"; $lang['This_posts_IP'] = "IP for this post";
$lang['Other_IPS_this_user'] = "Other IP's this user has posted from"; $lang['Other_IP_this_user'] = "Other IP's this user has posted from";
$lang['Other_users_this_IP'] = "Other users who have used this IP"; $lang['Users_this_IP'] = "Users posting from this IP";
$lang['IP_info'] = "IP Information"; $lang['IP_info'] = "IP Information";
$lang['Lookup_IP'] = "Look up IP";
// //
// Timezones ... for display on each page // Timezones ... for display on each page
// //

View file

@ -40,9 +40,7 @@ $page_title = "Modertator Control Panel";
$forum_id = ($HTTP_POST_VARS[POST_FORUM_URL]) ? $HTTP_POST_VARS[POST_FORUM_URL] : $HTTP_GET_VARS[POST_FORUM_URL]; $forum_id = ($HTTP_POST_VARS[POST_FORUM_URL]) ? $HTTP_POST_VARS[POST_FORUM_URL] : $HTTP_GET_VARS[POST_FORUM_URL];
$topic_id = ($HTTP_POST_VARS[POST_TOPIC_URL]) ? $HTTP_POST_VARS[POST_TOPIC_URL] : $HTTP_GET_VARS[POST_TOPIC_URL]; $topic_id = ($HTTP_POST_VARS[POST_TOPIC_URL]) ? $HTTP_POST_VARS[POST_TOPIC_URL] : $HTTP_GET_VARS[POST_TOPIC_URL];
if( empty($forum_id) || !isset($forum_id) )
if(empty($forum_id) || !isset($forum_id))
{ {
$sql = "SELECT f.forum_id, f.forum_name, f.forum_topics $sql = "SELECT f.forum_id, f.forum_name, f.forum_topics
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
@ -750,34 +748,53 @@ switch($mode)
} }
break; break;
case 'ip': case 'ip':
$post_id = $HTTP_GET_VARS[POST_POST_URL]; $post_id = ( isset($HTTP_GET_VARS[POST_POST_URL]) ) ? $HTTP_GET_VARS[POST_POST_URL] : "";
if(!$post_id) $rdns_ip_num = ( isset($HTTP_GET_VARS['rdns']) ) ? $HTTP_GET_VARS['rdns'] : "";
if( !$post_id )
{ {
message_die(GENERAL_ERROR, "Error, no post id found", "Error", __LINE__, __FILE__); message_die(GENERAL_ERROR, "Error, no post id found", "Error", __LINE__, __FILE__);
} }
// Look up relevent data for this post // Look up relevent data for this post
$sql = "SELECT poster_ip, poster_id FROM ".POSTS_TABLE." WHERE post_id = $post_id"; $sql = "SELECT poster_ip, poster_id
FROM " . POSTS_TABLE . "
WHERE post_id = $post_id";
if(!$result = $db->sql_query($sql)) if(!$result = $db->sql_query($sql))
{ {
message_die(GENERAL_ERROR, "Could not get poster IP information", "Error", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Could not get poster IP information", "Error", __LINE__, __FILE__, $sql);
} }
$post_row = $db->sql_fetchrow($result); $post_row = $db->sql_fetchrow($result);
$ip_this_post = decode_ip($post_row['poster_ip']); $ip_this_post = decode_ip($post_row['poster_ip']);
$ip_this_post = ( $rdns_ip_num == $ip_this_post ) ? gethostbyaddr($ip_this_post) : $ip_this_post;
$poster_id = $post_row['poster_id']; $poster_id = $post_row['poster_id'];
$template->assign_vars(array("L_IPINFO" => $lang['IP_info'], $template->assign_vars(array(
"L_IPTHISPOST" => $lang['IP_on_this_post'], "L_IP_INFO" => $lang['IP_info'],
"L_OTHERIPS" => $lang['Other_IPS_this_user'], "L_THIS_POST_IP" => $lang['This_posts_IP'],
"L_OTHERUSERS" => $lang['Other_users_this_IP'], "L_OTHER_IPS" => $lang['Other_IP_this_user'],
"L_SEARCHPOSTS" => $lang['Search_user_posts'], "L_OTHER_USERS" => $lang['Users_this_IP'],
"IP" => $ip_this_post)); "L_SEARCH_POSTS" => $lang['Search_user_posts'],
"L_LOOKUP_IP" => $lang['Lookup_IP'],
"SEARCH_IMG" => $images['icon_search'],
"IP" => $ip_this_post,
"U_LOOKUP_IP" => append_sid("modcp.$phpEx?mode=ip&" . POST_POST_URL . "=$post_id&" . POST_TOPIC_URL . "=$topic_id&rdns=" . $ip_this_post))
);
// //
// Get other IP's this user has posted under // Get other IP's this user has posted under
// //
$sql = "SELECT DISTINCT poster_ip FROM " . POSTS_TABLE . " WHERE poster_id = $poster_id AND poster_ip <> '".$post_row['poster_ip']."'"; $sql = "SELECT DISTINCT poster_ip
FROM " . POSTS_TABLE . "
WHERE poster_id = $poster_id
AND poster_ip <> '" . $post_row['poster_ip'] . "'
ORDER BY poster_ip DESC";
if(!$result = $db->sql_query($sql)) if(!$result = $db->sql_query($sql))
{ {
message_die(GENERAL_ERROR, "Could not get IP information for this user", "Error", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Could not get IP information for this user", "Error", __LINE__, __FILE__, $sql);
@ -787,13 +804,27 @@ switch($mode)
for($i = 0; $i < count($poster_ips); $i++) for($i = 0; $i < count($poster_ips); $i++)
{ {
$ip = decode_ip($poster_ips[$i]['poster_ip']); $ip = decode_ip($poster_ips[$i]['poster_ip']);
$template->assign_block_vars("iprow", array("IP" => $ip)); $ip = ( $rdns_ip_num == $ip ) ? gethostbyaddr($ip) : $ip;
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars("iprow", array(
"ROW_COLOR" => "#" . $row_color,
"ROW_CLASS" => $row_class,
"IP" => $ip,
"U_LOOKUP_IP" => append_sid("modcp.$phpEx?mode=ip&" . POST_POST_URL . "=$post_id&amp;" . POST_TOPIC_URL . "=$topic_id&amp;rdns=" . $ip))
);
} }
// //
// Get other users who've posted under this IP // Get other users who've posted under this IP
// //
$sql = "SELECT DISTINCT u.username, u.user_id FROM " . USERS_TABLE ." u, " . POSTS_TABLE . " p WHERE p.poster_id = u.user_id AND p.poster_ip = '".$post_row['poster_ip']."'"; $sql = "SELECT DISTINCT u.username, u.user_id
FROM " . USERS_TABLE ." u, " . POSTS_TABLE . " p
WHERE p.poster_id = u.user_id
AND p.poster_ip = '" . $post_row['poster_ip'] . "'";
if(!$result = $db->sql_query($sql)) if(!$result = $db->sql_query($sql))
{ {
message_die(GENERAL_ERROR, "Could not get posters information based on IP", "Error", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Could not get posters information based on IP", "Error", __LINE__, __FILE__, $sql);
@ -803,16 +834,19 @@ switch($mode)
for($i = 0; $i < count($poster_ids); $i++) for($i = 0; $i < count($poster_ids); $i++)
{ {
$id = $poster_ids[$i]['user_id']; $id = $poster_ids[$i]['user_id'];
$username = $poster_ids[$i]['username']; $username = ( $is == ANONYMOUS ) ? $lang['Guest'] : $poster_ids[$i]['username'];
if($id == ANONYMOUS) $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
{ $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$username = $lang['Guest'];
}
$template->assign_block_vars("userrow", array("U_PROFILE" => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$id"), $template->assign_block_vars("userrow", array(
"USERNAME" => $username, "USERNAME" => $username,
"U_SEARCHPOSTS" => append_sid("search.$phpEx?a=" . urlencode($username) . "&amp;f=all&amp;b=0&amp;d=DESC&amp;c=100&amp;dosearch=1"))); "ROW_COLOR" => "#" . $row_color,
"ROW_CLASS" => $row_class,
"U_PROFILE" => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$id"),
"U_SEARCHPOSTS" => append_sid("search.$phpEx?a=" . urlencode($username) . "&amp;f=all&amp;b=0&amp;d=DESC&amp;c=100&amp;dosearch=1"))
);
} }
$template->pparse("viewip"); $template->pparse("viewip");

View file

@ -1,34 +1,51 @@
<table width="98%" cellspacing="0" cellpadding="4" border="0" align="center"> <table width="80%" cellspacing="0" cellpadding="4" border="0" align="center">
<tr> <tr>
<td align="left"><span class="gensmall"><a href="{U_INDEX}">{SITENAME}&nbsp;{L_INDEX}</a></span></td> <td align="left"><span class="gensmall"><a href="{U_INDEX}">{SITENAME}&nbsp;{L_INDEX}</a></span></td>
</tr> </tr>
</table> </table>
<table width="98%" cellpadding="1" cellspacing="0" border="0" align="center"> <table width="80%" cellpadding="1" cellspacing="0" border="0" align="center">
<tr> <tr>
<td class="tablebg"><table width="100%" cellpadding="3" cellspacing="1" border="0"> <td class="tablebg"><table width="100%" cellpadding="3" cellspacing="1" border="0">
<tr> <tr>
<th class="cat" colspan="2"><span class="cattitle"><b>{L_IPINFO}</b></span></th> <th>{L_IP_INFO}</th>
</tr> </tr>
<tr> <tr>
<td class="row1" width="15%"><span class="gen">{L_IPTHISPOST}</span></td> <td class="cat"><span class="cat"><b>{L_THIS_POST_IP}</b></span></td>
<td class="row2"><span class="gen">{IP}</td>
</tr> </tr>
<tr> <tr>
<th class="cat" colspan="2" align="left"><span class="cattitle"><b>{L_OTHERUSERS}</b></span></th> <td class="row1"><table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td>&nbsp;<span class="gen">{IP}</span></td>
<td align="right"><span class="gen">[ <a href="{U_LOOKUP_IP}">{L_LOOKUP_IP}</a> ]&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td class="cat"><span class="cattitle"><b>{L_OTHER_USERS}</b></span></td>
</tr> </tr>
<!-- BEGIN userrow --> <!-- BEGIN userrow -->
<tr> <tr>
<td class="row1" colspan="2"><span class="gen"><a href="{userrow.U_PROFILE}">{userrow.USERNAME}</a> [<a href="{userrow.U_SEARCHPOSTS}">{L_SEARCHPOSTS}</a>]</td> <td class="{userrow.ROW_CLASS}"><table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td>&nbsp;<span class="gen"><a href="{userrow.U_PROFILE}">{userrow.USERNAME}</a></span></td>
<td align="right"><a href="{userrow.U_SEARCHPOSTS}"><img src="{SEARCH_IMG}" border="0" alt="{L_SEARCH_POSTS}" /></a> &nbsp;</td>
</tr>
</table></td>
</tr> </tr>
<!-- END userrow --> <!-- END userrow -->
<tr> <tr>
<th class="cat" colspan="2" align="left"><span class="cattitle"><b>{L_OTHERIPS}</b></span></th> <td class="cat"><span class="cattitle"><b>{L_OTHER_IPS}</b></span></td>
</tr> </tr>
<!-- BEGIN iprow --> <!-- BEGIN iprow -->
<tr> <tr>
<td class="row1" colspan="2"><span class="gen">{iprow.IP}</td> <td class="{iprow.ROW_CLASS}"><table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td>&nbsp;<span class="gen">{iprow.IP}</span></td>
<td align="right"><span class="gen">[ <a href="{iprow.U_LOOKUP_IP}">{L_LOOKUP_IP}</a> ]&nbsp;</td>
</tr>
</table></td>
</tr> </tr>
<!-- END iprow --> <!-- END iprow -->
</table></td> </table></td>