Example #1
0
function member_get($run = 0)
{
    if (intval($_GET['clear'])) {
        cache_del('member_get');
    }
    $member_cache = load_cache('member_get');
    $save_data = $member_cache ? $member_cache : '';
    global $head_url, $header_config, $_G;
    $temp_cache_data = '';
    if (!$_GET['submit'] || $run == 0) {
        num_limit('strayer_member', '15000', 'member_num_limit');
        $info['header'] = pick_header_output($header_config, $head_url);
        $info['save_data'] = $save_data;
        return $info;
    } else {
        if (intval($_GET['submit']) == 2) {
            unset($save_data);
        }
        if (!$save_data) {
            show_pick_info(milu_lang('start_config'));
        }
        $info = pick_common_get();
        $info['jump_num'] = $info['jump_num'] ? $info['jump_num'] : 45;
        $now_get = $save_data['now_get'] ? $save_data['now_get'] : 0;
        $info['member_field'] = dunserialize($info['member_field']);
        $limit_num = $info['jump_num'] > $info['num'] ? $info['num'] : $info['jump_num'];
        $uid_arr = get_data_range($info['uid_range'], $now_get, $limit_num);
        $all_get_time = $save_data['all_get_time'] ? $save_data['all_get_time'] : 0;
        $success_count = $save_data['success_count'] ? $save_data['success_count'] : 0;
        $uid_url_arr = get_user_url_arr($info['url'], $uid_arr['list']);
        $all_uid_count = $uid_arr['all_num'];
        $get_count = $temp_cache_data['get_count'] = $save_data['get_count'] ? $save_data['get_count'] : ($info['num'] && $info['num'] < $all_uid_count ? $info['num'] : $all_uid_count);
        foreach ($uid_url_arr as $k => $v) {
            d_s();
            show_pick_info(array(milu_lang('pick_url'), $v['url']), 'url', array('li_no_end' => 1, 'no_border' => 1, 'now' => $now_get + 1));
            $info['get_url'] = $v['url'];
            $re = pick_get_user_info($info);
            $now_get++;
            $pro = ceil(100 * ($success_count / $get_count));
            $get_time = d_e(0);
            $all_get_time += $get_time;
            $avg_get_time = $all_get_time / $success_count;
            $wait_count = $get_count - $success_count;
            $wait_time = $avg_get_time * $wait_count;
            $wait_time = $success_count == 0 && $wait_time == 0 ? milu_lang('un_know') : $wait_time;
            $pro = $success_count == 0 && $pro == 0 ? '0%' : $pro;
            if (function_exists('php_set')) {
                $memory = 100 * (get_memory() / php_set('memory_limit'));
                $memory = $memory || $memory != 0 ? sprintf('%.0f%%', $memory) : milu_lang('un_know');
            }
            $show_arr = array('pro' => $pro, 'wait_time' => $wait_time, 'memory' => $memory, 'wait_count' => $wait_count, 'now' => $now_get + 1);
            $temp_cache_data['now_get'] = $now_get;
            $temp_cache_data['all_get_time'] = $all_get_time;
            if (is_array($re)) {
                $check = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('strayer_member') . " WHERE get_uid ='{$v['uid']}' AND get_web_url='{$info['url']}'"), 0);
                if ($check) {
                    show_pick_info($re['username'] . ' ' . milu_lang('data_have'), 'err', $show_arr);
                } else {
                    $success_count++;
                    $temp_cache_data['success_count'] = $show_arr['success_count'] = $success_count;
                    $show_arr['wait_count'] = $get_count - $success_count;
                    $wait_time = $avg_get_time * $wait_count;
                    $show_arr['wait_time'] = $wait_time;
                    $setarr = format_member_data($re);
                    $setarr['get_dateline'] = $_G['timestamp'];
                    $setarr['get_uid'] = $v['uid'];
                    $setarr['get_web_url'] = $info['url'];
                    $setarr = paddslashes($setarr);
                    DB::insert("strayer_member", $setarr, true);
                    show_pick_info($re['username'] . ' ' . milu_lang('info_add'), 'success', $show_arr);
                }
            } else {
                if ($re == -1) {
                    show_pick_info(milu_lang('no_get_content'), 'err', $show_arr);
                }
                if ($re == -2) {
                    show_pick_info(milu_lang('no_any_info'), 'err', $show_arr);
                }
                if ($re == -3) {
                    show_pick_info(milu_lang('no_must_info'), 'err', $show_arr);
                }
                if ($re == -4) {
                    show_pick_info(milu_lang('no_user_space'), 'err', $show_arr);
                }
                if ($re == -5) {
                    show_pick_info(milu_lang('username_no_chinese'), 'err', $show_arr);
                }
                //
                if ($re == -6) {
                    show_pick_info(milu_lang('AccessDenied'), 'err', $show_arr);
                }
                //
            }
            if ($success_count == $get_count || $success_count > $get_count) {
                break;
            }
            if (is_int($now_get / $info['jump_num']) && $now_get != 0 && $success_count < $get_count) {
                cache_data('member_get', $temp_cache_data, 3600);
                data_go('member&myac=member_get&submit=1');
                exit;
            }
        }
        if ($success_count < $get_count && $info['reg_num']) {
            if ($info['jump_num'] > $get_count) {
                cache_data('member_get', $temp_cache_data, 3600);
                data_go('member&myac=member_get&submit=1');
                exit;
            }
            show_pick_info(milu_lang('no_member_reg'), 'finsh');
        }
        $all_get_time_str = diff_time($all_get_time, 1);
        $all_get_time_str = $all_get_time_str ? $all_get_time_str : sprintf('%.2f', $all_get_time) . '秒';
        $finsh_output = milu_lang('pick_user_finsh', array('n' => $now_get, 's' => $success_count, 'n_s' => $now_get - $success_count, 'all' => $all_get_time_str, 'avg' => sprintf('%.2f', $avg_get_time)));
        cache_del('member_get');
        $show_arr['wait_count'] = $show_arr['wait_time'] = 0;
        $show_arr['pro'] = 100;
        $show_arr['memory'] = $memory;
        show_pick_info($finsh_output, 'finsh', $show_arr);
    }
}
Example #2
0
function fastpick_import()
{
    global $head_url, $header_config;
    if (!submitcheck('submit')) {
        $info['header'] = pick_header_output($header_config, $head_url);
        num_limit('strayer_fastpick', 3000, 'f_num_limit');
        return $info;
    } else {
        $rules_code = $_GET['rules_code'];
        if ($rules_code) {
            $data = $rules_code;
        } else {
            $file_name = str_iconv($_FILES['rules_file']['tmp_name']);
            $fp = fopen($file_name, 'r');
            $data = fread($fp, $_FILES['rules_file']['size']);
        }
        //print_r($data);
        $arr = pimportfile($data);
        if (empty($arr['rules_name'])) {
            $arr['rules_name'] = $_G['timestamp'];
        }
        unset($arr['id'], $arr['version']);
        //销毁采集器记录的ID与 版本号
        if ($arr['pick']['pid']) {
            cpmsg_error(milu_lang('import_error2', array('url' => PICK_GO)));
        }
        if (!$arr['rules_hash']) {
            cpmsg_error(milu_lang('rules_error_data'));
        }
        $check = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('strayer_fastpick') . " WHERE id='{$arr['id']}'"), 0);
        if ($check && !$update_flag) {
            if (!$rules_code) {
                $rules_code = $data;
            }
            cpmsg(milu_lang('cover_notice') . '?<input type="hidden" value="' . dstripslashes($rules_code) . '" name="rules_code">', PICK_GO . 'picker_manage&myfunc=rules_import&pid=' . $pid . '&addsubmit=1&update_flag=1', 'form');
        }
        $arr = get_table_field_name('strayer_fastpick', $arr);
        unset($arr['rid']);
        //去掉主键
        $arr = paddslashes($arr);
        if ($update_flag) {
            $rules_hash = $arr['rules_hash'];
            unset($arr['rules_hash']);
            DB::update('strayer_fastpick', $arr, array('rules_hash' => $rules_hash));
        } else {
            DB::insert('strayer_fastpick', $arr, TRUE);
        }
        del_search_index(1);
        cpmsg(milu_lang('import_finsh'), PICK_GO . "fast_pick&myac=fastpick_import", 'succeed');
    }
}
Example #3
0
function rules_import()
{
    global $_G, $header_config, $head_url;
    $data['header'] = pick_header_output($header_config, $head_url);
    $submit = $_GET['addsubmit'];
    $update_flag = $_GET['update_flag'];
    num_limit('strayer_rules', 3000, 's_num_limit');
    if ($submit) {
        $rules_code = $_GET['rules_code'];
        if ($rules_code) {
            $data = $rules_code;
        } else {
            $file_name = str_iconv($_FILES['rules_file']['tmp_name']);
            $fp = fopen($file_name, 'r');
            $data = fread($fp, $_FILES['rules_file']['size']);
        }
        $arr = pimportfile($data);
        //采集器名称为空,则对将当前的时间戳做为采集器文件名
        if (empty($arr['rules_name'])) {
            $arr['rules_name'] = $_G['timestamp'];
        }
        unset($arr['rid'], $arr['version']);
        //销毁采集器记录的ID与 版本号
        $arr = daddslashes($arr);
        //对值重新addslashes操作
        if ($arr['pick']['pid']) {
            cpmsg_error(milu_lang('import_error2', array('url' => PICK_GO)));
        }
        if (!$arr['rules_hash']) {
            cpmsg_error(milu_lang('rules_error_data'));
        }
        $check = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('strayer_rules') . " WHERE rules_hash='{$arr['rules_hash']}'"), 0);
        if ($check && !$update_flag) {
            if (!$rules_code) {
                $rules_code = $data;
            }
            cpmsg(milu_lang('cover_notice') . '?<input type="hidden" value="' . dstripslashes($data) . '" name="rules_code">', PICK_GO . 'system_rules&myac=rules_import&pid=' . $pid . '&addsubmit=1&update_flag=1', 'form');
        }
        $arr = get_table_field_name('strayer_rules', $arr);
        unset($arr['rid']);
        //去掉主键
        if ($update_flag) {
            $rules_hash = $arr['rules_hash'];
            rules_update($rules_hash);
            unset($arr['rules_hash']);
            DB::update('strayer_rules', $arr, array('rules_hash' => $rules_hash));
        } else {
            DB::insert('strayer_rules', $arr, TRUE);
        }
        del_search_index(2);
        cpmsg(milu_lang('import_finsh'), PICK_GO . "system_rules&myac=rules_list", 'succeed');
    }
    return $data;
}
Example #4
0
function pick_import()
{
    global $_G, $head_url, $header_config;
    if (!submitcheck('submit')) {
        num_limit('strayer_picker', 3000, 'p_num_limit');
        $info['header'] = pick_header_output($header_config, $head_url);
        return $info;
    } else {
        $rules_code = $_GET['rules_code'];
        $pick_cid = $_GET['pick_cid'];
        if ($rules_code) {
            $data = $rules_code;
        } else {
            $file_name = str_iconv($_FILES['rules_file']['tmp_name']);
            $fp = fopen($file_name, 'r');
            $data = fread($fp, $_FILES['rules_file']['size']);
        }
        $arr = pimportfile($data);
        if ($arr['rules_hash']) {
            cpmsg_error(milu_lang('import_error', array('url' => PICK_GO)));
        }
        if (!$arr['pick']['pid']) {
            cpmsg_error(milu_lang('rules_error_data', array('url' => PICK_GO)));
        }
        pick_import_data($arr, $pick_cid);
        cpmsg(milu_lang('import_finsh'), PICK_GO . "picker_manage", 'succeed');
    }
}
Example #5
0
<?php

if (!defined('IN_DISCUZ')) {
    exit('Access Denied');
}
require_once DISCUZ_ROOT . 'source/plugin/milu_pick/config.inc.php';
pload('F:pick,F:copyright,F:output');
if ($_GET['pid']) {
    $info = get_pick_info();
    $info = show_pick_format($info);
} else {
    num_limit('strayer_picker', 3000, 'p_num_limit');
}
if ($_GET['turn_type']) {
    $info = get_trun_data();
    $info['rules_type'] = 2;
    $info['theme_url_test'] = $info['theme_url_test'] ? $info['theme_url_test'] : $info['detail_ID_test'];
}
$step = $_GET['step'];
if (!$step) {
    $step = 1;
}
$info['time_out'] = $pick_config['time_out'];
include_once libfile('function/portalcp');
require_once libfile('function/forumlist');
$threadtypes = getthreadtypes(array('typeid' => $info['public_class'][1], 'fid' => $info['public_class'][0]));
$forumselect = '<select id="forums" name="forums" onchange="getthreadtypes(this.value, 0)">' . forumselect(FALSE, 0, $info['public_class'][0], TRUE) . '</select>';
$portalselect = category_showselect('portal', 'portal', FALSE, $info['public_class'][0]);
$blogselect = category_showselect('blog', 'blog', TRUE, $info['public_class'][0]);
$show_bottom_js = bottom_js_output($info);
$info['pick_cid'] = $info['pick_cid'] ? $info['pick_cid'] : intval($_GET['pick_cid']);