Files
IPB/upload/sources/action_admin/member_tools.php
T
2025-12-19 00:21:15 -08:00

547 lines
19 KiB
PHP

<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.1.7
| =============================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
+---------------------------------------------------------------------------
| > $Date: 2005-10-10 14:08:54 +0100 (Mon, 10 Oct 2005) $
| > $Revision: 23 $
| > $Author: matt $
+---------------------------------------------------------------------------
|
| > Admin Member Tool functions
| > Module written by Matt Mecham
| > Date started: 17th September 2003
|
| > Module Version Number: 1.0.0
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Íåâåðíûé âõîä</h1> Ó Âàñ íåò äîñòóïà ê äèðåêòèâå ýòîãî ôàéëà. Åñëè Âû ïðîâîäèëè îáíîâëåíèÿ, óáåäèòåñü, ÷òî íå çàáûëè îáíîâèòü 'admin.php'.";
exit();
}
$root_path = "";
class ad_member_tools
{
var $base_url;
var $modules = "";
/**
* Section title name
*
* @var string
*/
var $perm_main = "content";
/**
* Section title name
*
* @var string
*/
var $perm_child = "mtools";
function auto_run()
{
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
$this->ipsclass->admin->nav[] = array( $this->ipsclass->form_code, 'Èíñòðóìåíòû IP' );
//-----------------------------------------
$this->ipsclass->admin->page_title = "Èíñòðóìåíòû IP";
$this->ipsclass->admin->page_detail = 'Ýòà ñåêöèÿ ïîçâîëÿåò âàì áûñòðî è ïðîñòî îïåðèðîâàòü ñ IP-àäðåñàìè ïîëüçîâàòåëåé.';
switch($this->ipsclass->input['code'])
{
case 'showallips':
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':view' );
$this->show_ips();
break;
case 'learnip':
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':view' );
$this->learn_ip();
break;
//-----------------------------------------
default:
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':view' );
$this->show_index();
break;
}
}
//-----------------------------------------
//
// LEARN ABOUT THE IP. It's very good.
//
//-----------------------------------------
function learn_ip()
{
if ( $this->ipsclass->input['ip'] == "" )
{
$this->show_index("Âû äîëæíû ââåñòè IP-àäðåñ äëÿ ïîèñêà");
}
$ip = trim($this->ipsclass->input['ip']);
$resolved = 'Íåäîñòóïíî (÷àñòè÷íûé IP-àäðåñ)';
$exact = 0;
if ( substr_count( $ip, '.' ) == 3 )
{
$exact = 1;
}
if ( strstr( $ip, '*' ) )
{
$exact = 0;
$ip = str_replace( "*", "", $ip );
}
if ( $exact != 0 )
{
$resolved = @gethostbyaddr($ip);
$query = "='".$ip."'";
}
else
{
$query = " LIKE '".$ip."%'";
}
//-----------------------------------------
$this->ipsclass->adskin->td_header[] = array( "&nbsp;" , "40%" );
$this->ipsclass->adskin->td_header[] = array( "&nbsp;" , "60%" );
//-----------------------------------------
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Õîñò {$this->ipsclass->input['ip']}" );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>IP-àäðåñ îïðåäåëÿåòñÿ êàê</b>" ,
$resolved
) );
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
//-----------------------------------------
// Find registered members
//-----------------------------------------
$this->ipsclass->adskin->td_header[] = array( "Ïîëüçîâàòåëü" , "30%" );
$this->ipsclass->adskin->td_header[] = array( "Àäðåñ email" , "20%" );
$this->ipsclass->adskin->td_header[] = array( "Ñîîáùåíèé" , "10%" );
$this->ipsclass->adskin->td_header[] = array( "IP-àäðåñ" , "20%" );
$this->ipsclass->adskin->td_header[] = array( "Çàðåãèñòðèðîâàí" , "20%" );
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Ïîëüçîâàòåëè, èñïîëüçîâàâøèå ýòîò IP ïðè ÐÅÃÈÑÒÐÀÖÈÈ" );
$this->ipsclass->DB->simple_construct( array( 'select' => 'id, name, email, posts, ip_address, joined',
'from' => 'members',
'where' => "ip_address{$query}",
'order' => 'joined DESC',
'limit' => array( 0,250) ) );
$this->ipsclass->DB->simple_exec();
if ( ! $this->ipsclass->DB->get_num_rows() )
{
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic( "Çàïèñåé íå íàéäåíî", "center");
}
else
{
while ( $m = $this->ipsclass->DB->fetch_row() )
{
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( $m['name'] ,
$m['email'],
$m['posts'],
$m['ip_address'],
$this->ipsclass->get_date( $m['joined'], 'SHORT' )
) );
}
}
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
//-----------------------------------------
// Find Names posted under
//-----------------------------------------
$this->ipsclass->adskin->td_header[] = array( "Ïîëüçîâàòåëü" , "20%" );
$this->ipsclass->adskin->td_header[] = array( "Àäðåñ email" , "20%" );
$this->ipsclass->adskin->td_header[] = array( "IP-àäðåñ" , "15%" );
$this->ipsclass->adskin->td_header[] = array( "Âïåðâûå èñïîëüçîâàí" , "20%" );
$this->ipsclass->adskin->td_header[] = array( "Ñîîáùåíèå" , "15%" );
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Ïîëüçîâàòåëè èñïîëüçîâàâøèå ýòîò IP ïðè ÍÀÏÈÑÀÍÈÈ ÑÎÎÁÙÅÍÈß" );
$this->ipsclass->DB->cache_add_query( 'member_tools_learn_ip_one', array( 'query' => $query) );
$this->ipsclass->DB->cache_exec_query();
if ( ! $this->ipsclass->DB->get_num_rows() )
{
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic( "Çàïèñåé íå íàéäåíî", "center");
}
else
{
while ( $m = $this->ipsclass->DB->fetch_row() )
{
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( $m['name'] ,
$m['email'],
$m['ip_address'],
$this->ipsclass->get_date( $m['post_date'], 'SHORT' ),
"<center><a href='index.php?showtopic={$m['topic_id']}&view=findpost&p={$m['pid']}' target='_blank'>Ïðîñìîòð</a></center>",
) );
}
}
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
//-----------------------------------------
// Find Names VOTED under
//-----------------------------------------
$this->ipsclass->adskin->td_header[] = array( "Ïîëüçîâàòåëü" , "20%" );
$this->ipsclass->adskin->td_header[] = array( "Àäðåñ email" , "20%" );
$this->ipsclass->adskin->td_header[] = array( "IP-àäðåñ" , "15%" );
$this->ipsclass->adskin->td_header[] = array( "Âïåðâûå èñïîëüçîâàí" , "20%" );
$this->ipsclass->adskin->td_header[] = array( "Ãîëîñîâàíèå" , "15%" );
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Ïîëüçîâàòåëè èñïîëüçîâàâøèå ýòîò IP ïðè ÃÎËÎÑÎÂÀÍÈÈ" );
$this->ipsclass->DB->cache_add_query( 'member_tools_learn_ip_two', array( 'query' => $query) );
$this->ipsclass->DB->cache_exec_query();
if ( ! $this->ipsclass->DB->get_num_rows() )
{
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic( "Çàïèñåé íå íàéäåíî", "center");
}
else
{
while ( $m = $this->ipsclass->DB->fetch_row() )
{
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( $m['name'] ,
$m['email'],
$m['ip_address'],
$this->ipsclass->get_date( $m['vote_date'], 'SHORT' ),
"<center><a href='index.php?showtopic={$m['tid']}' target='_blank'>Ïðîñìîòð</a></center>",
) );
}
}
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
//-----------------------------------------
// Find Names EMAILING under
//-----------------------------------------
$this->ipsclass->adskin->td_header[] = array( "Ïîëüçîâàòåëü" , "20%" );
$this->ipsclass->adskin->td_header[] = array( "Àäðåñ email" , "20%" );
$this->ipsclass->adskin->td_header[] = array( "IP-àäðåñ" , "15%" );
$this->ipsclass->adskin->td_header[] = array( "Âïåðâûå èñïîëüçîâàí" , "20%" );
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Ïîëüçîâàòåëè èñïîëüçîâàâøèå ýòîò IP ïðè ÎÒÏÐÀÂÊÅ EMAIL" );
$this->ipsclass->DB->cache_add_query( 'member_tools_learn_ip_three', array( 'query' => $query) );
$this->ipsclass->DB->cache_exec_query();
if ( ! $this->ipsclass->DB->get_num_rows() )
{
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic( "Çàïèñåé íå íàéäåíî", "center");
}
else
{
while ( $m = $this->ipsclass->DB->fetch_row() )
{
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( $m['name'] ,
$m['email'],
$m['from_ip_address'],
$this->ipsclass->get_date( $m['email_date'], 'SHORT' ),
) );
}
}
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
//-----------------------------------------
// Find Names VALIDATING under
//-----------------------------------------
$this->ipsclass->adskin->td_header[] = array( "Ïîëüçîâàòåëü" , "20%" );
$this->ipsclass->adskin->td_header[] = array( "Àäðåñ email" , "20%" );
$this->ipsclass->adskin->td_header[] = array( "IP-àäðåñ" , "15%" );
$this->ipsclass->adskin->td_header[] = array( "Âïåðâûå èñïîëüçîâàí" , "20%" );
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Ïîëüçîâàòåëè èñïîëüçîâàâøèå ýòîò IP ïðè ÀÊÒÈÂÀÖÈÈ Ó×ÅÒÍÎÉ ÇÀÏÈÑÈ" );
$this->ipsclass->DB->cache_add_query( 'member_tools_learn_ip_four', array( 'query' => $query) );
$this->ipsclass->DB->cache_exec_query();
if ( ! $this->ipsclass->DB->get_num_rows() )
{
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic( "Çàïèñåé íå íàéäåíî", "center");
}
else
{
while ( $m = $this->ipsclass->DB->fetch_row() )
{
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( $m['name'] ,
$m['email'],
$m['ip_address'],
$this->ipsclass->get_date( $m['entry_date'], 'SHORT' ),
) );
}
}
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
$this->ipsclass->admin->output();
}
//-----------------------------------------
//
// SHOW ALL IPs
//
//-----------------------------------------
function show_ips()
{
if ( $this->ipsclass->input['name'] == "" and $this->ipsclass->input['member_id'] == "" )
{
$this->show_index("Âû äîëæíû ââåñòè èìÿ ïîëüçîâàòåëÿ äëÿ ïîèñêà");
}
if ( $this->ipsclass->input['member_id'] )
{
$id = intval($this->ipsclass->input['member_id']);
$this->ipsclass->DB->simple_construct( array( 'select' => 'id, name, email, ip_address', 'from' => 'members', 'where' => "id=$id" ) );
$this->ipsclass->DB->simple_exec();
if ( ! $member = $this->ipsclass->DB->fetch_row() )
{
$this->show_index("Íåâîçìîæíî íàéòè ïîëüçîâàòåëÿ ñ ID '$id'.");
}
}
else
{
$name = addslashes($this->ipsclass->input['name']);
$this->ipsclass->DB->simple_construct( array( 'select' => 'id, name, email, ip_address', 'from' => 'members', 'where' => "name='$name'" ) );
$this->ipsclass->DB->simple_exec();
if ( ! $member = $this->ipsclass->DB->fetch_row() )
{
$this->show_index( "Íåâîçìîæíî íàéòè ïîëüçîâàòåëÿ ñ òàêèì èìåíåì, äëÿ äîïîëíèòåëüíûõ âîçìîæíîñòåé èñïîëüçóéòå ôîðìó íèæå", $name );
}
}
$this->ipsclass->DB->simple_construct( array( 'select' => 'count(distinct(ip_address)) as cnt', 'from' => 'posts', 'where' => "author_id={$member['id']}" ) );
$this->ipsclass->DB->simple_exec();
$count = $this->ipsclass->DB->fetch_row();
$st = intval($this->ipsclass->input['st']);
$end = 50;
$links = $this->ipsclass->build_pagelinks( array( 'TOTAL_POSS' => $count['cnt'],
'PER_PAGE' => $end,
'CUR_ST_VAL' => $st,
'L_SINGLE' => "Îäíà ñòðàíèöà",
'L_MULTI' => "Íåñêîëüêî ñòðàíèö",
'BASE_URL' => $this->ipsclass->base_url."&".$this->ipsclass->form_code."&code=showallips&member_id={$member['id']}",
) );
$master = array();
$ips = array();
$this->ipsclass->DB->cache_add_query( 'member_tools_show_ips', array( 'mid' => $member['id'], 'st' => $st, 'end' => $end ) );
$this->ipsclass->DB->cache_exec_query();
while ( $r = $this->ipsclass->DB->fetch_row() )
{
$master[] = $r;
$ips[] = "'".$r['ip_address']."'";
}
$reg = array();
if ( count($ips) > 0 )
{
$this->ipsclass->DB->simple_construct( array( 'select' => 'id, name, ip_address', 'from' => 'members', 'where' => "ip_address IN (".implode(",",$ips).") AND id != {$member['id']}" ) );
$this->ipsclass->DB->simple_exec();
while ( $i = $this->ipsclass->DB->fetch_row() )
{
$reg[ $i['ip_address'] ][] = $i;
}
}
//-----------------------------------------
$this->ipsclass->adskin->td_header[] = array( "IP-àäðåñ" , "20%" );
$this->ipsclass->adskin->td_header[] = array( "Âõîäîâ ñ ýòîãî IP" , "10%" );
$this->ipsclass->adskin->td_header[] = array( "Äàòà èñïîëüçîâàíèÿ" , "25%" );
$this->ipsclass->adskin->td_header[] = array( "Èñïîëüçîâàíî ïðè äðóãèõ ðåãèñòðàöèÿõ" , "20%" );
$this->ipsclass->adskin->td_header[] = array( "Èíñòðóìåíò IP" , "25%" );
//-----------------------------------------
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Ó ïîëüçîâàòåëÿ {$member['name']} íàéäåíî ({$count['cnt']}) óíèêàëüíûõ IP-àäðåñîâ" );
foreach( $master as $idx => $r )
{
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( $r['ip_address'] ,
$r['ip'] ,
$this->ipsclass->get_date( $r['post_date'], 'SHORT' ),
"<center>". intval( count($reg[ $r['ip_address'] ]) ). "</center>",
"<center><a href='{$this->ipsclass->base_url}&{$this->ipsclass->form_code}&code=learnip&ip={$r['ip_address']}'>Èíôî îá ýòîì IP</a></center>"
) );
}
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_basic( "$links", "center", "catrow2");
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
$this->ipsclass->admin->output();
}
//-----------------------------------------
//
// Default Screen
//
//-----------------------------------------
function show_index($msg="", $membername="")
{
if ($msg != "")
{
$this->ipsclass->adskin->td_header[] = array( "&nbsp;" , "100%" );
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Ñîîáùåíèå" );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( $msg ) );
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
}
$this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'code' , 'showallips' ),
2 => array( 'act' , 'mtools' ),
4 => array( 'section', $this->ipsclass->section_code ),
) );
//-----------------------------------------
$this->ipsclass->adskin->td_header[] = array( "&nbsp;" , "40%" );
$this->ipsclass->adskin->td_header[] = array( "&nbsp;" , "60%" );
//-----------------------------------------
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Ïîêàçàòü âñå IP-àäðåñà, êîòîðûå áûëè ó ýòîãî ïîëüçîâàòåëÿ â ìîìåíò äîáàâëåíèÿ ñîîáùåíèé" );
if ( $membername == "" )
{
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Ââåäèòå èìÿ ïîëüçîâàòåëÿ:</b>" ,
$this->ipsclass->adskin->form_input( "name", $this->ipsclass->txt_stripslashes($_POST['name']) )
) );
}
else
{
$this->ipsclass->DB->simple_construct( array( 'select' => 'id, name', 'from' => 'members', 'where' => "lower(name) LIKE '{$membername}%'" ) );
$this->ipsclass->DB->simple_exec();
if ( ! $this->ipsclass->DB->get_num_rows() )
{
$this->show_index("Íå íàéäåíî ïîëüçîâàòåëåé, ó êîòîðûõ èìÿ íà÷èíàåòñÿ ñ '$membername'.");
}
$mem_array = array();
while ( $m = $this->ipsclass->DB->fetch_row() )
{
$mem_array[] = array( $m['id'], $m['name'] );
}
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Âûáåðèòå ïîëüçîâàòåëÿ:</b>" ,
$this->ipsclass->adskin->form_dropdown( "member_id", $mem_array )
) );
}
$this->ipsclass->html .= $this->ipsclass->adskin->end_form("Íàéòè IP-àäðåñà ýòîãî ïîëüçîâàòåëÿ");
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
//-----------------------------------------
$this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'code' , 'learnip' ),
2 => array( 'act' , 'mtools' ),
4 => array( 'section', $this->ipsclass->section_code ),
) );
$this->ipsclass->adskin->td_header[] = array( "&nbsp;" , "40%" );
$this->ipsclass->adskin->td_header[] = array( "&nbsp;" , "60%" );
//-----------------------------------------
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Èíôîðìàöèÿ îá IP-àäðåñå" );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Âûâåñòè âñþ èíôîðìàöèþ îá IP...</b>" ,
$this->ipsclass->adskin->form_input( "ip", $this->ipsclass->txt_stripslashes($_POST['ip']) )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->end_form("Âûâåñòè!");
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
$this->ipsclass->admin->output();
}
}
?>