function get_member_setarr($v) { global $_G; $v = dstripslashes($v); $info = pick_common_get(); $setarr = $v; $setarr['oltime'] = $info['oltime_type'] == 1 && $v['oltime'] ? $v['oltime'] : get_data_range($info['oltime'], -1, 1); $setarr['regdate'] = $info['regdate_type'] == 1 && $v['regdate'] ? $v['regdate'] : get_rand_time($info['regdate_start_time'], $info['regdate_end_time']); $setarr['lastvisit'] = $setarr['lastactivity'] = rand($setarr['regdate'], $_G['timestamp']); $setarr['email'] = $v['email'] ? $v['email'] : rand_email($v['username']); if (!$v['qq']) { if (strexists($setarr['email'], '@qq.com')) { $qq_arr = explode('@', $setarr['email']); $setarr['qq'] = $qq_arr[0]; } else { $setarr['qq'] = rand(55054836, 1450250164); } } $info['rand_ip'] = $info['rand_ip'] ? $info['rand_ip'] : '202.106.189.3,202.106.189.4,202.106.189.6,218.247.166.82,218.30.119.114,218.30.119.114 4408,218.64.220.220,218.64.220.2,219.148.122.113,219.232.236.116,221.225.1.239,222.188.10.1,222.223.65.3,222.73.26.211,58.211.0.113,58.214.238.238,202.105.55.38,221.179.35.71,222.64.185.148,114.255.171.231,125.77.200.134'; //默认的ip地址列表 $ip_arr = format_wrap($info['rand_ip'], ','); $rand_ip = parray_rand($ip_arr); $setarr['lastip'] = $info['ip_type'] == 1 && $v['lastip'] ? $v['lastip'] : $rand_ip; $setarr['regip'] = $info['ip_type'] == 1 && $v['regip'] ? $v['regip'] : $rand_ip; $credits_list = credits_list(); foreach ((array) $credits_list as $k2 => $v2) { $setarr[$v2['name']] = $info[$v2['name'] . '_type'] == 1 && $v[$v2['name']] ? $v[$v2['name']] : get_data_range($info[$v2['name']], -1, 1); } return $setarr; }
/** * @param caleg_id */ function generate_comments($caleg_id, $force = false) { $comments = C::$comments; if ($force === false) { $res = mysql_query("select * from comment where caleg_id = '" . $caleg_id . "' limit 50"); if (mysql_num_rows($res) >= 50) { return; } } $comment_count = mt_rand(5, mt_getrandmax() - 1) / mt_getrandmax() * 50; for ($i = 0; $i < $comment_count; $i++) { $rate = mt_rand(1, mt_getrandmax() - 1) / mt_getrandmax() * 2 + rand_clg_id($caleg_id) % 5; if ($rate > 5) { $rate = 5; } if ($rate < 1) { $rate = 1; } $email = rand_email(); $comment = $comments[rand(0, count($comments) - 1)]; $qf = "insert into comment (title, content, user_email, caleg_id, created, updated) values ('%s', '%s', '%s', '%s', %d, %d)"; $result = mysql_query(sprintf($qf, $comment[0], $comment[1], $email, $caleg_id, time(), time())); $qf = "insert into caleg_rating (caleg_id, user_email, rating) values('%s', '%s', %f)"; mysql_query(sprintf($qf, $caleg_id, $email, floor(number_format($rate, 1) * 2) / 2)); } }