function verifyTiezi_gettie($tid, $ck) { $c = new wcurl('http://tieba.baidu.com/mo/m?kz=' . $tid, array('User-Agent: Chinese F*****g Phone')); $c->addcookie('BDUSS=' . $ck); $t = $c->exec(); preg_match('/<form action=\\"(.*?)\\" method=\\"post\\">/', $t, $formurl); preg_match('/<input type=\\"hidden\\" name=\\"ti\\" value=\\"(.*?)\\"\\/>/', $t, $ti); preg_match('/<input type=\\"hidden\\" name=\\"src\\" value=\\"(.*?)\\"\\/>/', $t, $src); preg_match('/<input type=\\"hidden\\" name=\\"word\\" value=\\"(.*?)\\"\\/>/', $t, $word); preg_match('/<input type=\\"hidden\\" name=\\"tbs\\" value=\\"(.*?)\\"\\/>/', $t, $tbs); preg_match('/<input type=\\"hidden\\" name=\\"fid\\" value=\\"(.*?)\\"\\/>/', $t, $fid); preg_match('/<input type=\\"hidden\\" name=\\"z\\" value=\\"(.*?)\\"\\/>/', $t, $z); preg_match('/<input type=\\"hidden\\" name=\\"floor\\" value=\\"(.*?)\\"\\/>/', $t, $floor); return array('__formurl' => $formurl[1], 'co' => '', 'ti' => $ti[1], 'src' => $src[1], 'word' => $word[1], 'tbs' => $tbs[1], 'ifpost' => '1', 'ifposta' => '0', 'post_info' => '0', 'tn' => 'baiduWiseSubmit', 'fid' => $fid[1], 'verify' => '', 'verify_2' => '', 'pinf' => '1_2_0', 'pic_info' => '', 'z' => $z[1], 'last' => '0', 'pn' => '0', 'r' => '0', 'see_lz' => '0', 'no_post_pic' => '0', 'floor' => $floor[1], 'sub1' => '回贴'); }
function wmzz_zan_do($kw, $pid, $tid, $b) { $pda = array('BDUSS' => $b, '_client_id' => 'wappc_1396611108603_817', '_client_type' => '2', '_client_version' => '5.7.0', '_phone_imei' => '642b43b58d21b7a5814e1fd41b08e2a6', 'action' => 'like', 'from' => 'tieba', 'kw' => $kw, 'post_id' => $pid, 'thread_id' => $tid); $ex = ''; foreach ($pda as $k => $v) { $ex .= $k . '=' . $v; } $pda['sign'] = md5($ex . 'tiebaclient!!!'); //!! $x = new wcurl('http://c.tieba.baidu.com/c/c/zan/like', array('Content-Type: application/x-www-form-urlencoded')); $x->addcookie('BDUSS=' . $b); $x->set(CURLOPT_TIMEOUT, 1); return $x->post($pda); //$x->close(); }
function cron_wmzz_ban() { global $m; $s = unserialize(option::get('plugin_wmzz_ban')); $now = strtotime(date('Y-m-d')); $y = $m->query("SELECT * FROM `" . DB_PREFIX . "wmzz_ban` WHERE `nextdo` <= '{$now}' LIMIT {$s['limit']}"); while ($x = $m->fetch_array($y)) { $r = wmzz_ban_getTime($x['date']); if ($r != '-1') { $bduss = misc::getCookie($x['pid']); $c = new wcurl('http://tieba.baidu.com/pmc/blockid'); $c->addcookie('BDUSS=' . $bduss); $c->post(array('user_name[]' => $x['user'], 'day' => $r, 'fid' => misc::getFid($x['tieba']), 'tbs' => misc::getTbs($x['uid'], $bduss), 'ie' => 'utf-8', 'reason' => $s['msg'])); $next = $now + $r * 86400; $m->query("UPDATE `" . DB_PREFIX . "wmzz_ban` SET `nextdo` = '{$next}' WHERE `id` = '{$x['id']}'"); } else { $m->query("DELETE FROM `" . DB_PREFIX . "wmzz_ban` WHERE `id` = '{$x['id']}'"); } } }
/** * 扫描指定PID的所有贴吧 * @param $pid PID */ public static function scanTiebaByPid($pid) { global $i; global $m; $cma = $m->once_fetch_array("SELECT * FROM `" . DB_PREFIX . "baiduid` WHERE `id` = '{$pid}';"); $uid = $cma['uid']; $ubduss = $cma['bduss']; $isvip = self::isvip($uid); $pid = $cma['id']; $table = self::getTable($uid); $n3 = 1; $n = 0; $n2 = 0; $addnum = 0; $list = array(); $o = option::get('tb_max'); while (true) { $url = 'http://tieba.baidu.com/f/like/mylike?&pn=' . $n3; $n3++; $addnum = 0; $c = new wcurl($url, array('User-Agent: Phone XXX')); $c->addcookie("BDUSS=" . $ubduss); $ch = $c->exec(); $c->close(); preg_match_all('/\\<td\\>(.*?)\\<a href=\\"\\/f\\?kw=(.*?)\\" title=\\"(.*?)\\">(.*?)\\<\\/a\\>\\<\\/td\\>/', $ch, $list); foreach ($list[3] as $v) { $n++; if (!empty($o) && $isvip == false && $n > $o) { break 2; } $v = addslashes(htmlspecialchars(mb_convert_encoding($v, "UTF-8", "GBK"))); $osq = $m->once_fetch_array("SELECT COUNT(*) AS `C` FROM `" . DB_NAME . "`.`" . DB_PREFIX . $table . "` WHERE `uid` = " . $uid . " AND `pid` = '{$pid}' AND `tieba` = '{$v}';"); if ($osq['C'] == '0') { $m->query("INSERT INTO `" . DB_NAME . "`.`" . DB_PREFIX . $table . "` (`id`, `pid`, `uid`, `tieba`, `no`, `latest`) VALUES (NULL, {$pid}, " . $uid . ", '{$v}', 0, 0);"); } $addnum++; } if ($n3 > 100) { break; //100页后重复 } if (!isset($list[3][0])) { break; //完成 } elseif ($o != 0 && $n2 >= $o && $isvip == false) { break; //超限 } $n2 = $n2 + $addnum; } }
/** * 执行一个网络请求而不等待返回结果 * @param string $url URL * @param string $post post数据包,留空为get * @param string $cookie cookies * @return bool fsockopen是否成功 */ function sendRequest($url, $post = '', $cookie = '') { if (function_exists('fsockopen')) { $matches = parse_url($url); $host = $matches['host']; if (substr($url, 0, 8) == 'https://') { $host = 'ssl://' . $host; } $path = $matches['path'] ? $matches['path'] . ($matches['query'] ? '?' . $matches['query'] : '') : '/'; $port = !empty($matches['port']) ? $matches['port'] : 80; if (!empty($post)) { $out = "POST {$path} HTTP/1.1\r\n"; $out .= "Content-Type: application/x-www-form-urlencoded\r\n"; $out .= "Host: {$host}\r\n"; $out .= "Connection: Close\r\n\r\n"; $out .= $post; } else { $out = "GET {$path} HTTP/1.1\r\n"; $out .= "Host: {$host}\r\n"; $out .= "Connection: Close\r\n\r\n"; } $fp = fsockopen($host, $port); if (!$fp) { return false; } else { stream_set_blocking($fp, 0); stream_set_timeout($fp, 0); fwrite($fp, $out); fclose($fp); return true; } } else { $x = new wcurl($url); $x->set(CURLOPT_CONNECTTIMEOUT, 1); $x->set(CURLOPT_TIMEOUT, 1); $x->addcookie($cookie); if (empty($post)) { $x->post($post); } else { $x->exec(); } return true; } }
/** * 客户端签到 */ public static function DoSign_Client($uid, $kw, $id, $pid, $fid, $ck) { $ch = new wcurl('http://c.tieba.baidu.com/c/c/forum/sign', array('Content-Type: application/x-www-form-urlencoded', 'User-Agent: F*****g iPhone/1.0 BadApple/99.1')); $ch->addcookie("BDUSS=" . $ck); $temp = array('BDUSS' => misc::getCookie($pid), '_client_id' => '03-00-DA-59-05-00-72-96-06-00-01-00-04-00-4C-43-01-00-34-F4-02-00-BC-25-09-00-4E-36', '_client_type' => '4', '_client_version' => '1.2.1.17', '_phone_imei' => '540b43b59d21b7a4824e1fd31b08e9a6', 'fid' => $fid, 'kw' => $kw, 'net_type' => '3', 'tbs' => misc::getTbs($uid, $ck)); $x = ''; foreach ($temp as $k => $v) { $x .= $k . '=' . $v; } $temp['sign'] = strtoupper(md5($x . 'tiebaclient!!!')); return $ch->post($temp); }