/** * Search initialization */ public function init() { parent::init(); $this->getRandomAccount(); // Set dir for cookies $this->temporaryDir = __DIR__ . '/tmp/cookie/'; if (!is_dir($this->temporaryDir)) { mkdir($this->temporaryDir, 0775, true); } $this->cookieFile = $this->temporaryDir . md5($this->_params['user'] . $this->_params['password']) . '.txt'; }
function init() { global $_config; if (!$_config) { require_once SYSTEM_ROOT . './config.inc.php'; } $this->init_header(); $this->init_useragent(); CACHE::pre_fetch('setting', 'plugin', 'plugins'); Updater::init(); $this->init_syskey(); $this->init_cookie(); cloud::init(); HOOK::INIT(); $this->init_final(); }
<p><b>这是一款免费软件,作者 <a href="http://www.ikk.me" target="_blank">kookxiang</a>,你可以从 www.kookxiang.com 上下载到这个项目的最新版本。</b></p> <p>如果有人向您兜售本程序,麻烦您给个差评。</p><br> <p>配置签到助手之后,我们会在每天的 0:30 左右为您自动签到。</p> <p>签到过程不需要人工干预,您可以选择签到之后发送一封邮件报告到您的注册邮箱。</p><br> <p>准备好了吗?点击下面的“下一步”按钮开始配置吧</p> <p class="btns"><button class="btn submit" onclick="$('#guide_page_1').hide();$('#guide_page_2').show();">下一步 »</button></p> </div> <div id="guide_page_2" class="hidden"> <p>首先,你需要绑定你的百度账号。</p><br> <p>为了确保账号安全,我们只储存你的百度 Cookie,不会保存你的账号密码信息。</p> <p>你可以通过修改密码的方式来让这些 Cookie 失效。</p><br> <form method="post" action="api.php?action=baidu_login" target="_blank"> <p>百度通行证:<input type="text" name="username" placeholder="推荐使用邮箱登陆" required value="" /></p> <p>通行证密码:<input type="password" name="password" placeholder="百度通行证密码" required value="" /></p> <p><input type="submit" value="绑定百度账号" /> <a href="https://api.ikk.me/v2/manual_bind.php?sid=<?php echo cloud::id(); ?> &formhash=<?php echo $formhash; ?> " class="btn" target="_blank">手动绑定</a></p> </form> </div> <div id="guide_page_manual" class="hidden"></div> <div id="guide_page_3" class="hidden"> <p>一切准备就绪~</p><br> <p>我们已经成功接收到你百度账号信息,自动签到已经准备就绪。</p> <p>您可以点击 <a href="#setting">高级设置</a> 更改邮件设定,或更改其他附加设定。</p><br> <p>感谢您的使用!</p><br> <p>程序作者:kookxiang (<a href="http://www.ikk.me" target="_blank">http://www.ikk.me</a>)</p> <p>赞助开发:<a href="https://me.alipay.com/kookxiang" target="_blank">https://me.alipay.com/kookxiang</a></p>
if ($formhash != $_POST['formhash']) { showmessage('来源不可信,请重试', 'admin.php#setting'); } $title = daddslashes($_POST['title']); $content = daddslashes($_POST['content']); $content = nl2br(htmlspecialchars($content)); $content .= "<p style=\"padding: 1.5em 1em 0; color: #999; font-size: 12px;\">—— 本邮件由 贴吧签到助手 (<a href=\"{$siteurl}\">{$siteurl}</a>) 管理员发送</p>"; $query = DB::query("SELECT email FROM member"); while ($result = DB::fetch($query)) { DB::insert('mail_queue', array('to' => $result['email'], 'subject' => $title, 'content' => $content)); } saveSetting('mail_queue', 1); showmessage('已经添加至邮件队列,稍后将由系统自动发送', 'admin.php#mail'); break; case 'cloud_sync': $ret = cloud::sync(); showmessage($ret ? '站点信息同步成功!' : '同步信息失败,请稍后再试', 'admin.php#setting'); break; case 'load_plugin': exit(json_encode(getPlugins())); break; case 'load_template': exit(json_encode(getTemplates())); break; case 'load_cron': exit(json_encode(getCron())); break; case 'skip_cron': if (!defined('AFENABLED')) { exit; }
<thead><tr><td style="width: 40px">UID</td><td>用户名</td><td class="mobile_hidden">邮箱</td><td>操作</td></tr></thead> <tbody></tbody> </table> </div> <div id="content-stat" class="hidden"> <h2>用户签到统计</h2> <table> <thead><tr><td style="width: 40px">UID</td><td>用户名</td><td>已成功</td><td>已跳过</td><td>待签到</td><td>待重试</td><td>不支持</td></tr></thead> <tbody></tbody> </table> </div> <div id="content-setting" class="hidden"> <h2>系统设置</h2> <p>云平台管理:</p> <?php if ($sid = cloud::id()) { ?> <p>站点ID: <?php echo $sid; ?> </p> <p>当前域名:<?php echo $siteurl; ?> </p> <p> <a href="admin.php?action=cloud_sync&formhash=<?php echo $formhash; ?> " class="btn red" onclick="return msg_win_action(this.href)">同步站点信息</a> <?php
function handleAction() { global $uid, $formhash; $status = -1; $msg = '未登录!'; $data = array('time' => time()); if ($_SERVER['HTTP_USER_AGENT'] != 'Android Client For Tieba Signer') { exit(json_encode(array('status' => -2, 'msg' => '非法操作', 'data' => $data))); } else { if ($_GET['a'] == 'api_info') { $status = 0; $data = array('version' => '1.0.0', 'site' => $_SERVER["HTTP_HOST"]); } elseif ($_GET['a'] == 'do_login') { if (!empty($_POST['username']) && !empty($_POST['password'])) { $username = daddslashes($_POST['username']); $un = strtolower($username); if (strlen($username) > 24) { $msg = '用户名过长,请修改'; $status = 3; } else { $user = DB::fetch_first("SELECT * FROM member WHERE username='******'"); $verified = Widget_Password::verify($user, $_POST['password']); if ($verified) { $login_exp = TIMESTAMP + 3600; do_login($user['uid']); $status = 0; $msg = "欢迎回来,{$user['username']}!"; $data = array('uid' => $user['uid'], 'username' => $user['username'], 'email' => $user['email'], 'formhash' => substr(md5(substr(TIMESTAMP, 0, -7) . $user['username'] . $user['uid'] . ENCRYPT_KEY . ROOT), 8, 8)); } else { $status = 2; $msg = "对不起,您的用户名或密码错误,无法登录"; } } } else { $status = 1; $msg = '用户名或密码不得为空!'; } } elseif ($_GET['a'] == 'check_login') { if ($uid) { $status = 0; } if ($uid) { $msg = '您已登录'; } } elseif ($formhash != $_GET['formhash']) { $status = -2; $msg = '非法操作'; } elseif ($uid) { $status = 0; $msg = ""; require_once ROOT . './plugins/zw_client_api/BaiduUtil.php'; $binded_baidu = true; $cookie = get_cookie($uid); if (empty($cookie)) { $binded_baidu = false; } else { try { $baiduUtil = new BaiduUtil(get_cookie($uid)); } catch (Exception $e) { if ($e->getCode() == -99) { $binded_baidu = false; } } } switch ($_GET['a']) { case 'baidu_info': if ($binded_baidu) { $msg = '百度账号信息'; try { $baidu_account_info = $baiduUtil->fetchClientUserInfo(); $baidu_account_tieba_list = $baiduUtil->fetchClientLikedForumList(); $baidu_account_follow_list = $baiduUtil->fetchFollowList(4); $baidu_account_fans_list = $baiduUtil->fetchFansList(4); $data = array('id' => $baidu_account_info['data']['id'], 'username' => $baidu_account_info['data']['un'], 'avatar' => $baidu_account_info['data']['head_photo_h'], 'sex' => $baidu_account_info['data']['sex'], 'tb_age' => $baidu_account_info['data']['tb_age'], 'fans_num' => $baidu_account_info['data']['fans_num'], 'follow_num' => $baidu_account_info['data']['concern_num'], 'tb_num' => $baidu_account_info['data']['like_forum_num'], 'intro' => $baidu_account_info['data']['intro'] ? $baidu_account_info['data']['intro'] : '这个家伙很懒,什么也没有留下', 'tiebas' => $baidu_account_tieba_list['data'] ? $baidu_account_tieba_list['data'] : array(), 'follow' => $baidu_account_follow_list['data'], 'fans' => $baidu_account_fans_list['data']); } catch (Exception $e) { $status = "3"; $msg = '助手站点错误:' . $e->getMessage(); } } else { $status = 1; $msg = "未绑定百度账号"; } break; case 'unbind_baidu': DB::query("UPDATE member_setting SET cookie='' WHERE uid='{$uid}'"); DB::query("DELETE FROM my_tieba WHERE uid='{$uid}'"); DB::query("DELETE FROM sign_log WHERE uid='{$uid}'"); $msg = "已经解除百度账号绑定,您可以稍后重新进行绑定"; break; case 'sign_log': $msg = '获取成功'; $date = intval($_GET['date']); $data['date'] = $date; $data['log'] = array(); $query = DB::query("SELECT * FROM sign_log l LEFT JOIN my_tieba t ON t.tid=l.tid WHERE l.uid='{$uid}' AND l.date='{$date}'"); while ($result = DB::fetch($query)) { $data['log'][] = $result; } $data['count'] = count($data['log']); $previous_date = DB::result_first("SELECT date FROM sign_log WHERE uid='{$uid}' AND date<'{$date}' ORDER BY date DESC LIMIT 0,1"); $next_date = DB::result_first("SELECT date FROM sign_log WHERE uid='{$uid}' AND date>'{$date}' ORDER BY date ASC LIMIT 0,1"); $data['previous_date'] = $previous_date ? $previous_date : '0'; $data['next_date'] = $next_date ? $next_date : '0'; break; case 'cloud_info': $msg = '获取成功'; $data['sid'] = cloud::id(); break; case 'plugin_info': $msg = '获取成功'; $plugin_info = CACHE::get('plugins'); $data['plugins'] = array(); $plugin_supported = array('zw_custom_page' => array('name' => '自定义页面', 'author' => 'JerryLocke'), 'zw_blockid' => array('name' => '循环封禁', 'author' => 'JerryLocke'), 'x_tdou' => array('name' => 'T豆', 'author' => '星弦雪'), 'xxx_post' => array('name' => '客户端回帖', 'author' => '星弦雪'), 'xxx_meizi' => array('name' => '妹纸认证', 'author' => '星弦雪')); foreach ($plugin_info as $plugin) { if (isset($plugin_supported[$plugin['id']])) { $data['plugins'][] = $plugin + $plugin_supported[$plugin['id']]; } } $data['count'] = count($data['plugins']); break; } } echo json_encode(array('status' => $status, 'msg' => $msg, 'data' => $data)); } }
require_once './system/common.inc.php'; if (!$uid) { header('Location: member.php'); exit; } if ($_GET['action'] == 'baidu_login') { $parms = array($_POST['username'], $_POST['password'], $formhash); $parm_string = serialize($parms); $parm_string = authcode($parm_string, 'ENCODE', cloud::key()); $parm_string = bin2hex($parm_string); header('Location: ' . cloud::get_api_path() . 'login.php?sid=' . cloud::id() . '&parm=' . $parm_string); } elseif ($_GET['action'] == 'register_cloud') { cloud::do_register(); } elseif ($_GET['action'] == 'receive_cookie') { $_cookie = $_POST['cookie'] ? $_POST['cookie'] : $_GET['cookie']; if (!$_cookie) { throw new Exception('Empty response!'); } if ($_GET['formhash'] != $formhash) { throw new Exception('Illegal request!'); } $cookie = authcode(pack('H*', $_cookie), 'DECODE', cloud::key()); if (!$cookie) { showmessage('非法调用!', './#baidu_bind', 1); } if (!verify_cookie($cookie)) { showmessage('无法登陆百度贴吧,请尝试重新绑定<form action="api.php?action=receive_cookie&formhash=' . $formhash . '" method="post"><input type="hidden" name="cookie" value="' . $_cookie . '"></from><script type="text/javascript">setTimeout(function(){ document.forms[0].submit(); }, 2000);</script>'); } save_cookie($uid, $cookie); showmessage('绑定百度账号成功!<br>正在同步喜欢的贴吧...<script type="text/javascript" src="index.php?action=refresh_liked_tieba&formhash=' . $formhash . '"></script><script type="text/javascript">try{ opener.$("#guide_page_2").hide(); opener.$("#guide_page_manual").hide(); opener.$("#guide_page_3").show(); window.close(); }catch(e){}</script>', './#baidu_bind', 1); }
<?php if (!defined('IN_KKFRAME')) { exit; } cron_set_nextrun($tomorrow); CACHE::clear(); $date = date('Ymd', TIMESTAMP + 900); DB::query("INSERT IGNORE INTO sign_log (tid, uid, `date`) SELECT tid, uid, '{$date}' FROM my_tieba"); $delete_date = date('Ymd', TIMESTAMP - 86400 * 30); DB::query("DELETE FROM sign_log WHERE date<'{$delete_date}'"); saveSetting('extsign_uid', 0); saveSetting('autoupdate_uid', 0); Updater::check(); cloud::check_remote_disabled();
<?php if (!defined('IN_KKFRAME')) { exit; } $obj = $_PLUGIN['obj']['cloud_stat']; if (!$obj && file_exists(ROOT . 'plugins/cloud_stat/plugin.class.php')) { $obj = new plugin_cloud_stat(); } $date = date('Ymd', TIMESTAMP); $tieba = intval($obj->getSetting('tieba')); $exp = intval($obj->getSetting('exp')); $tieba += DB::result_first("SELECT COUNT(*) FROM sign_log WHERE status=2 AND date='{$date}'"); $obj->saveSetting('tieba', $tieba); $exp += DB::result_first("SELECT SUM(exp) FROM sign_log WHERE status=2 AND date='{$date}'"); $obj->saveSetting('exp', $exp); /* send data */ $sid = cloud::id(); $key = cloud::key(); $sign = md5($key . $sid . $tieba . $exp . $key); $ret = kk_fetch_url("http://api.ikk.me/stat.php?sid={$sid}&tieba={$tieba}&exp={$exp}&sign={$sign}"); if ($ret) { $data = json_decode($ret); if ($data) { $obj->saveSetting('cloud_tieba', $data->tieba); $obj->saveSetting('cloud_exp', $data->exp); } } cron_set_nextrun($tomorrow + 3600);