Пример #1
0
.nav-tabs:before,
.nav-tabs:after{
  display: table;
  line-height: 0;
  content: "";
}
.nav-tabs:after{
  clear: both;
}
table.x_table thead tr{background-color:#dedede;}
</style>

<h2>客户端回帖</h2>
<p class="small_gray">当前插件版本:0.3.1 | 更新日期:14-04-29 | Designed By <a href="http://tieba.baidu.com/home/main?un=%D0%C7%CF%D2%D1%A9&fr=index" target="_blank">@星弦雪</a></p>
<p class="small_gray_i"><?php 
echo '——' . get_random_content();
?>
<div>
	<ul class="nav-tabs">
		<li class="active"><a>设置</a></li><li><a>记录</a></li><li><a>帮助</a></li>
	</ul>
</div>

<div class="x_tab_content">

<div>
	<h3>常规</h3>
	<form method="post" id="xxx_post_settings"
		action="plugin.php?id=xxx_post&action=set-settings"
		onsubmit="return post_win(this.action, this.id)">
		<p>
Пример #2
0
function client_rppost($uid, $tieba, $content)
{
    $cookie = get_cookie($uid);
    preg_match('/BDUSS=([^ ;]+);/i', $cookie, $matches);
    $BDUSS = trim($matches[1]);
    $setting = DB::fetch_first("SELECT * FROM xxx_post_setting WHERE uid='{$uid}'");
    if ($setting['client_type'] == 5) {
        $setting['client_type'] = rand(1, 4);
    }
    if (!$BDUSS) {
        return array(-1, '找不到 BDUSS Cookie');
    }
    if (!$content) {
        $content = get_random_content();
    }
    if (!$tieba['tid']) {
        $tieba['tid'] = get_random_tid($tieba['name']);
    }
    $formdata = array('BDUSS' => $BDUSS, '_client_id' => 'wappc_136' . random(10, true) . '_' . random(3, true), '_client_type' => $setting['client_type'], '_client_version' => '5.0.0', '_phone_imei' => md5(random(16)), 'anonymous' => 0, 'content' => $content, 'fid' => $tieba['fid'], 'kw' => urldecode($tieba['name']), 'net_type' => 3, 'tbs' => get_tbs($tieba['uid']), 'tid' => $tieba['tid'], 'title' => "");
    $adddata = '';
    foreach ($formdata as $k => $v) {
        $adddata .= $k . '=' . $v;
    }
    $sign = strtoupper(md5($adddata . 'tiebaclient!!!'));
    $formdata['sign'] = $sign;
    $ch = curl_init('http://c.tieba.baidu.com/c/c/post/add');
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_COOKIE, $cookie);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($formdata));
    $re = @json_decode(curl_exec($ch), ture);
    curl_close($ch);
    switch ($setting['client_type']) {
        case '1':
            $client_res = "iphone";
            break;
        case '2':
            $client_res = "android";
            break;
        case '3':
            $client_res = "WindowsPhone";
            break;
        case '4':
            $client_res = "Windows8";
            break;
    }
    if (!$re) {
        return array(0, 'JSON 解析错误');
    }
    if ($re['error_code'] == 0) {
        return array(2, "使用" . $client_res . '客户端发帖成功,<a href="http://tieba.baidu.com/p/' . $tieba['tid'] . '" target="_blank">查看帖子</a>');
    } else {
        if ($re['error_code'] == 5) {
            return array(5, "需要输入验证码,请检查你是否已经关注该贴吧。");
        } else {
            if ($re['error_code'] == 7) {
                return array(7, "您的操作太频繁了!");
            } else {
                if ($re['error_code'] == 8) {
                    return array(8, "您已经被封禁");
                } else {
                    return array($re['error_code'], "未知错误,错误代码:" . $re['error_code']);
                }
            }
        }
    }
}