function verifyTiezi_send($uid, $tid, $pid, $water = 'StusGame Tieba Cloud Sign Plugin "verifyTiezi"', $device = 4) { if (empty($uid) || empty($tid) || empty($pid)) { return array('status' => '1', 'msg' => ''); } $ck = misc::GetCookie($pid); $xs = verifyTiezi_gettie($tid, $ck); $x = array('BDUSS' => $ck, '_client_id' => 'wappc_136' . rand_int(10) . '_' . rand_int(3), '_client_type' => $device, '_client_version' => '5.0.0', '_phone_imei' => md5(rand_int(16)), 'anonymous' => '0', 'content' => $water, 'fid' => $xs['fid'], 'kw' => $xs['word'], 'net_type' => '3', 'tbs' => $xs['tbs'], 'tid' => $tid, 'title' => ''); $y = ''; foreach ($x as $key => $value) { $y .= $key . '=' . $value; } $x['sign'] = strtoupper(md5($y . 'tiebaclient!!!')); $c = new wcurl('http://c.tieba.baidu.com/c/c/post/add', array('Content-Type: application/x-www-form-urlencoded')); /* //Note:普通的 $x = verifyTiezi_gettie($tid,$ck); $c = new wcurl('http://tieba.baidu.com'.$x['__formurl']); unset($x['__formurl']); $x['co'] = $water; */ $c->addcookie('BDUSS=' . $ck); $return = json_decode($c->post($x), true); $c->close(); if (!empty($return['error_code']) && $return['error_code'] != '1') { return array('status' => $return['error_code'], 'msg' => $return['error_msg']); } else { return array('status' => '1', 'msg' => ''); } }
function mok_follow_check() { $head = array('User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36', 'Cookie:BDUSS=' . $_GET['bduss']); $opt = unserialize(option::get('mok_follow')); foreach ($opt['mustTieba'] as $tb => $lv) { $c = new wcurl('http://tieba.baidu.com/mo/m?kw=' . urlencode($tb), $head); $t = $c->get(); $c->close(); if (textMiddle($t, ' (等级', ')') < $lv) { msg($opt['error'][0]); } } if (count($opt['optionTieba']) > 0) { $check = false; foreach ($opt['optionTieba'] as $tb => $lv) { $c = new wcurl('http://tieba.baidu.com/mo/m?kw=' . urlencode($tb), $head); $t = $c->get(); $c->close(); if (textMiddle($t, ' (等级', ')') >= $lv) { $check = true; break; } } if ($check == false) { msg($opt['error'][0]); } } }
function cron_mok_zdwk() { //如果今天签到过了直接返回日志 if (option::get('mok_zdwk_run') == date('d')) { return option::get('mok_zdwk_log'); } global $m; $prefix = DB_PREFIX; //选出用户的options和bduss $res = $m->query("SELECT {$prefix}users_options.`name` , {$prefix}users_options.`value` , {$prefix}baiduid.`bduss` \nFROM {$prefix}baiduid\nINNER JOIN {$prefix}users_options ON {$prefix}users_options.uid = {$prefix}baiduid.uid\nWHERE {$prefix}users_options.`name` = 'mok_zdwk_wk'\nOR {$prefix}users_options.`name` = 'mok_zdwk_zd'"); $wk = $zd = 0; $bduss = array(); if ($m->num_rows($res) != 0) { while ($row = $res->fetch_array()) { //判断该选项是否开启 if ($row['value'] == 'on') { //记录bduss(数量),如果bduss数组内没有该bduss,则加入数组 if (!in_array($row['bduss'], $bduss)) { $bduss[] = $row['bduss']; } if ($row['name'] === 'mok_zdwk_wk') { $wk++; $head = array('Accept:*/*', 'Accept-Encoding:gzip, deflate, sdch', 'Accept-Language:zh-CN,zh;q=0.8', 'Connection:keep-alive', 'Host:wenku.baidu.com', 'Referer:http://wenku.baidu.com/task/browse/daily', 'User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36', 'X-Requested-With:XMLHttpRequest'); $c = new wcurl('http://wenku.baidu.com/task/submit/signin', $head); $c->addCookie('BDUSS=' . $row['bduss']); $c->exec(); $c->close(); } else { if ($row['name'] === 'mok_zdwk_zd') { $zd++; $c = new wcurl('http://zhidao.baidu.com/'); $c->addCookie('BDUSS=' . $row["bduss"]); $stoken = $c->get(); $c->close(); $stoken = textMiddle($stoken, '"stoken":"', '",'); if ($stoken != "") { $c = new wcurl('http://zhidao.baidu.com/submit/user'); $c->addCookie('BDUSS=' . $row["bduss"]); $c->post(array('cm' => '100509', 'utdata' => '90,90,102,96,107,101,99,97,96,90,98,103,103,99,127,106,99,99,14138554765830', 'stoken' => $stoken)); $c->close(); } } } } } } $log = "知道、文库签到完毕<br/>" . date("Y-m-d H:i:s") . "<br/>共计百度账号: " . count($bduss) . " 个<br/>知道签到: {$zd} 个<br/>文库签到: {$wk} 个"; option::set('mok_zdwk_run', date('d')); option::set('mok_zdwk_log', $log); return $log; }
function wmzz_zan_getpage($kw, $bduss) { $pda = array('BDUSS' => $bduss, '_client_id' => 'wappc_1396611108603_817', '_client_type' => '2', '_client_version' => '5.7.0', '_phone_imei' => '642b43b58d21b7a5814e1fd41b08e2a6', 'from' => 'tieba', 'kw' => $kw, 'pn' => '1', 'q_type' => '2', 'rn' => '50', 'with_group' => '1'); $ex = ''; foreach ($pda as $k => $v) { $ex .= $k . '=' . $v; } $pda['sign'] = md5($ex . 'tiebaclient!!!'); //!! //CURL POST $x = new wcurl('http://c.tieba.baidu.com/c/f/frs/page', array("Content-Type: application/x-www-form-urlencoded")); $x->addcookie('BDUSS=' . $bduss); $x->set(CURLOPT_TIMEOUT, 1); $r = $x->post($pda); $x->close(); return json_decode($r, true); }
function mok_bgimg_header() { global $i; $mok_bgimg = unserialize($i['opt']['mok_bgimg']); $mok_bgimg_img = unserialize($i['opt']['mok_bgimg_img']); $mok_bgimg_bing = unserialize($i['opt']['mok_bgimg_bing']); $img = explode("\r\n", $mok_bgimg['img']); //图片列表 if (count($img) > 0 || $mok_bgimg_img['bing'] == '1') { //至少要有一张图片或开启bing每日壁纸 //自动更换 if ($mok_bgimg['change'] != 0) { $change = false; //是否更换 if ($mok_bgimg['change'] == 1) { //每天更换 if ($mok_bgimg_img['day'] != date('d')) { $change = true; } } elseif ($mok_bgimg['change'] == 2) { //每小时更换 if ($mok_bgimg_img['hour'] != date('H')) { $change = true; } } elseif ($mok_bgimg['change'] == 3) { //每次访问更换 $change = true; } if ($change) { //记录背景更换时间 $mok_bgimg_img['day'] = date('d'); $mok_bgimg_img['hour'] = date('H'); if ($mok_bgimg['bing'] == '1') { //如果使用bing每日壁纸 $c = new wcurl('http://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1'); $data = json_decode($c->get(), true); $c->close(); if (!empty($data['images'][0]['url'])) { option::set('mok_bgimg_bing', serialize(array('img' => $data['images'][0]['url']))); $mok_bgimg_img['img'] = $data['images'][0]['url']; } } else { if ($mok_bgimg['mode'] == 0) { //顺序更换 $key = array_search($mok_bgimg_img['img'], $img); //在图片列表中寻找当前背景图的序号 if ($key !== false) { if (count($img) == $key + 1) { //如果当前图片已经是最后一张 $mok_bgimg_img['img'] = $img[0]; } else { $mok_bgimg_img['img'] = $img[$key + 1]; } } else { //如果在图片列表中没有找到当前背景图,就从第一张背景图开始 $mok_bgimg_img['img'] = $img[0]; } } elseif ($mok_bgimg['mode'] == 1) { //随机更换 $mok_bgimg_img['img'] = $img[mt_rand(0, count($img) - 1)]; } } } } //第一次安装插件时此值为空,自动使用第一张图 if ($mok_bgimg_img['img'] == '') { $mok_bgimg_img['img'] = $img[0]; } //背景重复 if ($mok_bgimg['repeat'] == 3 || $mok_bgimg['repeat'] == 4) { //静态悬浮 if ($mok_bgimg['repeat'] == 3) { echo '<div id="mok_bgimg" style="width:100%;height:100%;background-size:100% 100%;background-image:url(\'' . $mok_bgimg_img['img'] . '\');position:fixed;"></div>'; } else { echo '<div id="mok_bgimg" style="width:100%;height:100%;background-size:100% auto;background-image:url(\'' . $mok_bgimg_img['img'] . '\');position:fixed;"></div>'; } } else { if ($mok_bgimg['repeat'] == 0) { //纵向重复 $tmp[] = 'background-repeat:repeat-y'; } else { $tmp[] = 'background-repeat:no-repeat'; } if ($mok_bgimg['repeat'] == 2) { //拉伸全屏 $tmp[] = 'background-size:100% 100%'; } else { $tmp[] = 'background-size:100% auto'; } $tmp[] = 'background-image:url(' . $mok_bgimg_img['img'] . ')'; $css = implode(';', $tmp) . ';'; echo '<style>body {' . $css . '}</style>'; } option::set('mok_bgimg_img', serialize($mok_bgimg_img)); //保存背景图片和更换时间 //透明选项 $css = '<style>'; if ($mok_bgimg['daohang'] == 1) { $css .= '.navbar{background:none !important}'; } if ($mok_bgimg['chengxuxinxi'] == 1) { $css .= '.panel{background:none !important}'; } if ($mok_bgimg['yonghuxinxi'] == 1) { $css .= '.list-group-item{background:none !important}'; } if ($mok_bgimg['liebiao'] == 1) { $css .= '.table-striped>tbody>tr:nth-of-type(odd){background:none !important}'; } if ($mok_bgimg['liebiaoxian'] == 1) { $css .= '.table>tbody>tr>td{border-top:none !important}'; } if ($mok_bgimg['tishikuang'] == 1) { $css .= '.alert{background:none !important}'; } if ($mok_bgimg['caidan'] == 1) { $css .= '.nav>li>a:hover, .nav>li>a:focus{background:none !important}'; } if ($mok_bgimg['shurukuang'] == 1) { $css .= '.form-control{background:none !important}'; } if ($mok_bgimg['anniu'] == 1) { $css .= '.btn{background:none !important}'; } //字体颜色 if (!empty($mok_bgimg['c_putong'])) { $css .= 'body{color:' . $mok_bgimg['c_putong'] . '}'; } if (!empty($mok_bgimg['c_zuoce'])) { $css .= '.container .nav>li>a{color:' . $mok_bgimg['c_zuoce'] . '}'; } if (!empty($mok_bgimg['c_dingbu'])) { $css .= '.navbar-default .navbar-nav>li>a,.navbar-default .navbar-brand{color:' . $mok_bgimg['c_dingbu'] . ' !important}'; } if (!empty($mok_bgimg['c_shurukuang'])) { $css .= '.form-control{color:' . $mok_bgimg['c_shurukuang'] . '}'; } $css .= '</style>'; echo $css; } }
if (file_exists($floderName . '/app.conf')) { unlink($floderName . '/app.conf'); } if (file_exists($floderName . '/config.yaml')) { unlink($floderName . '/config.yaml'); } //覆盖文件 if (CopyAll($floderName, SYSTEM_ROOT) !== true) { DeleteFile(UPDATE_CACHE); msg('错误 - 更新失败:<br/><br/>无法更新文件'); } DeleteFile(UPDATE_CACHE); //获取最新的版本号 $c = new wcurl('http://kenvix.oschina.io/tieba-cloud-sign/'); $data = json_decode($c->exec(), true); $c->close(); //修改版本号 option::set('vid', $data['vid']); //暂不支持更新脚本 msg('恭喜您,更新成功!', SYSTEM_URL . 'index.php?mod=admin:update&ok'); break; case 'admin:update:changeServer': if (isset($_GET['server'])) { option::set('update_server', $_GET['server']); } break; case 'baiduid:getverify': global $m; if (option::get('bduss_num') == '-1' && ROLE != 'admin') { msg('本站禁止绑定新账号'); }
/** * 扫描指定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; } }
/** * 获取一个bduss对应的百度用户名 * * @param string $bduss BDUSS * @return string|bool 百度用户名,失败返回FALSE */ function getBaiduId($bduss) { $c = new wcurl('http://wapp.baidu.com/'); $c->addCookie(array('BDUSS' => $bduss, 'BAIDUID' => strtoupper(md5(time())))); $data = $c->get(); $c->close(); return urldecode(textMiddle($data, 'i?un=', '">')); }
/** * 获取一个bduss对应的百度用户名 * * @param string $bduss BDUSS * @return string|bool 百度用户名,失败返回FALSE */ function getBaiduId($bduss) { global $m; $header[] = 'Content-Type:application/x-www-form-urlencoded; charset=UTF-8'; $header[] = 'Cookie: BDUSS=' . $bduss; $c = new wcurl('http://wapp.baidu.com/', $header); $data = $c->get(); $c->close(); return urldecode(textMiddle($data, 'i?un=', '">')); }
/** * 网页签到 */ public static function DoSign_Default($uid, $kw, $id, $pid, $fid, $ck) { global $m, $today; $cookie = array('BDUSS' => $ck, 'BAIDUID' => strtoupper(md5(time()))); $ch = new wcurl('http://tieba.baidu.com/mo/m?kw=' . urlencode($kw) . '&fid=' . $fid, array('User-Agent: f**k phone', 'Referer: http://wapp.baidu.com/', 'Content-Type: application/x-www-form-urlencoded')); $ch->addcookie($cookie); $s = $ch->exec(); $ch->close(); preg_match('/\\<td style=\\"text-align:right;\\"\\>\\<a href=\\"(.*)\\"\\>签到\\<\\/a\\>\\<\\/td\\>\\<\\/tr\\>/', $s, $s); if (isset($s[1])) { $ch = new wcurl('http://tieba.baidu.com' . $s[1], array('Accept: text/html, application/xhtml+xml, */*', 'Accept-Language: zh-Hans-CN,zh-Hans;q=0.8,en-US;q=0.5,en;q=0.3', 'User-Agent: F*****g Phone')); $ch->addcookie($cookie); $ch->exec(); $ch->close(); //临时判断解决方案 $ch = new wcurl('http://tieba.baidu.com/mo/m?kw=' . urlencode($kw) . '&fid=' . $fid, array('User-Agent: f**k phone', 'Referer: http://wapp.baidu.com/', 'Content-Type: application/x-www-form-urlencoded')); $ch->addcookie($cookie); $s = $ch->exec(); $ch->close(); //如果找不到这段html则表示没有签到则stripos()返回false,同时is_bool()返回true,最终返回false return !is_bool(stripos($s, '<td style="text-align:right;"><span >已签到</span></td>')); } else { return true; } }