$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 "

Неверный вход

У Вас нет доступа к директиве этого файла. Если Вы проводили обновления, убедитесь, что не забыли обновить '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( " " , "40%" ); $this->ipsclass->adskin->td_header[] = array( " " , "60%" ); //----------------------------------------- $this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Хост {$this->ipsclass->input['ip']}" ); $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "IP-адрес определяется как" , $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' ), "
Просмотр
", ) ); } } $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' ), "
Просмотр
", ) ); } } $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' ), "
". intval( count($reg[ $r['ip_address'] ]) ). "
", "
Инфо об этом IP
" ) ); } $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( " " , "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( " " , "40%" ); $this->ipsclass->adskin->td_header[] = array( " " , "60%" ); //----------------------------------------- $this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Показать все IP-адреса, которые были у этого пользователя в момент добавления сообщений" ); if ( $membername == "" ) { $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Введите имя пользователя:" , $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( "Выберите пользователя:" , $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( " " , "40%" ); $this->ipsclass->adskin->td_header[] = array( " " , "60%" ); //----------------------------------------- $this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Информация об IP-адресе" ); $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Вывести всю информацию об IP..." , $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(); } } ?>