if ($fids) { $num = 0; $query = $db->query("SELECT fid,name FROM pw_forums WHERE type<>'category' AND cms='0'"); while ($fm = $db->fetch_array($query)) { if (strpos($fids, ',' . $fm['fid'] . ',') !== false) { $num++; $htm_tr = $num % 5 == 0 ? '</tr><tr>' : ''; $forumcheck .= "<td width='20%'>{$fm['name']}</td>{$htm_tr}"; } } } !$rt['creditype'] && ($rt['creditype'] = 'currency'); require_once uTemplate::PrintEot('profile_toolcenter'); pwOutPut(); } else { if (procLock('tool_buy', $winduid)) { S::gp(array('buymethod', 'nums'), null, 2); $toolinfo = $db->get_one("SELECT * FROM pw_tools WHERE id=" . S::sqlEscape($id)); if ($nums <= 0) { procUnLock('tool_buy', $winduid); Showmsg('illegal_nums'); } if ($toolinfo['stock'] < $nums) { procUnLock('tool_buy', $winduid); Showmsg('unenough_stock'); } if ($buymethod) { if ($toolinfo['rmb'] <= 0) { procUnLock('tool_buy', $winduid); Showmsg('undefined_action'); }
// update posts hits if ($c_htm || $db_hits_store == 2) { $db_hithour == 0 && ($db_hithour = 4); $hit_wtime = $hit_control * $db_hithour; $hit_wtime > 24 && ($hit_wtime = 0); $hitsize = @filesize(D_P . 'data/bbscache/hits.txt'); if ($hitsize && ($hitsize > 1024 || $timestamp - $hit_tdtime > $hit_wtime * 3600) && procLock('hitupdate')) { require_once R_P . 'require/hitupdate.php'; procUnLock('hitupdate'); } } if ($higholnum < $usertotal) { pwQuery::update('pw_bbsinfo', 'id=:id', array(1), array('higholnum' => $usertotal, 'higholtime' => $timestamp)); $higholnum = $usertotal; } if ($hposts < $tposts) { pwQuery::update('pw_bbsinfo', 'id=:id', array(1), array('hposts' => $tposts)); $hposts = $tposts; } $mostinbbstime = get_date($higholtime); if (!$ol_offset && $db_onlinelmt != 0 && $usertotal >= $db_onlinelmt) { Cookie('ol_offset', '', 0); Showmsg('most_online'); } if ($plantime && $timestamp > $plantime && procLock('task')) { require_once R_P . 'require/task.php'; procUnLock('task'); } require_once PrintEot('index'); CloudWind::yunSetCookie(SCR); footer();
function jobGainController($userid, $jobid) { $jobid = intval($jobid); if ($jobid < 1) { return array(false, "抱歉,任务ID无效"); } //是否存在这个任务 $job = $this->getJob($jobid); if (!$job) { return array(false, "抱歉,任务不存在"); } if (procLock('job_save', $userid)) { $jober = $this->getJoberByJobId($userid, $jobid); if (!$jober) { return $this->_unlockUserJob($userid, array(false, "抱歉,你还没有申请这个任务")); } /*检查是否是一次性任务或完成*/ if (!$job['period'] && $jober['total'] > 1) { return $this->_unlockUserJob($userid, array(false, "抱歉,你已经完成这个任务")); } /*任务时间限制 start*/ $timeout = 0; $factor = isset($job['factor']) && $job['factor'] != "" ? unserialize($job['factor']) : array(); if ($factor && isset($factor['limit']) && $factor['limit'] > 0) { if ($jober['last'] + $factor['limit'] * $this->_hour < $this->_timestamp) { $timeout = 1; } } /*下次执行时间*/ if (isset($job['period']) && $job['period'] > 0) { $next = $this->_timestamp + $job['period'] * $this->_hour; $next = $next ? $next : $this->_timestamp; } if ($timeout) { $this->updateJober(array('status' => 5, 'next' => $next), $jober['id']); $this->reduceJobNum($userid); return $this->_unlockUserJob($userid, array(true, "抱歉,任务没有在规定的时间内完成")); } /*任务时间限制 end */ if ($factor) { if ($jober['status'] < 2) { return $this->_unlockUserJob($userid, array(true, "抱歉,你还没有完成任务")); } if ($jober['status'] > 3) { return $this->_unlockUserJob($userid, array(true, "抱歉,数据错误,请重试")); } } if ($jober['status'] == 3) { return $this->_unlockUserJob($userid, array(true, "抱歉,你已经领取过奖励,不能重复领取")); } $data = array(); $data['status'] = 3; /*任务完成*/ $data['total'] = $jober['total'] + 1; $data['next'] = $next; $result = $this->updateJober($data, $jober['id']); if (!$result) { return $this->_unlockUserJob($userid, array(false, "抱歉,领取奖励失败,请重试")); } if (isset($job['reward'])) { $this->jobRewardHandler($userid, $job); } $this->reduceJobNum($userid); /*任务完成*/ $information = implode(' ', $this->getCategoryInfo($job['reward'])); $information = $information ? "," . $information : ""; return $this->_unlockUserJob($userid, array(true, "恭喜你完成任务" . $information)); } else { return array(false, "抱歉,领取奖励失败,请重试"); } }
Showmsg('bk_credit_type_error'); } $change = (int) $change; if (!is_numeric($change) || $change <= 0) { Showmsg('bk_credit_fillin_error'); } $change % $jf_A[$type][0] != 0 && Showmsg('change_error'); list($sell, $buy) = explode('_', $type); $credit1 = $change; $credit2 = intval($change / $jf_A[$type][0] * $jf_A[$type][1]); /* $db->query("LOCK TABLES pw_memberdata WRITE,pw_membercredit WRITE"); $lockfile = D_P.'data/bbscache/lock_profile.txt'; $fp = fopen($lockfile,'wb+'); flock($fp,LOCK_EX); */ if (procLock('credit_change', $winduid)) { if ($credit1 > $credit->get($winduid, $sell)) { procUnLock('credit_change', $winduid); Showmsg('bk_credit_change_error'); } $credit->addLog('main_changereduce', array($sell => -$credit1), array('uid' => $winduid, 'username' => $windid, 'ip' => $onlineip, 'tocname' => $credit->cType[$buy])); $credit->addLog('main_changeadd', array($buy => $credit2), array('uid' => $winduid, 'username' => $windid, 'ip' => $onlineip, 'fromcname' => $credit->cType[$sell])); $credit->sets($winduid, array($sell => -$credit1, $buy => $credit2)); procUnLock('credit_change', $winduid); //fclose($fp); //$db->query("UNLOCK TABLES"); } refreshto('userpay.php?action=change', 'bank_creditsuccess', 1, true); } }
<?php !function_exists('readover') && exit('Forbidden'); $cachefile = D_P . 'data/bbscache/brith_cache.php'; if ((!file_exists($cachefile) || pwFilemtime($cachefile) <= $tdtime) && procLock('birth')) { list($nyear, $nmonth, $nday) = explode('-', get_date($timestamp, 'Y-n-j')); $birthnum = 0; $query = $db->query("SELECT username,bday,gender FROM pw_members WHERE MONTH(bday)=" . S::sqlEscape($nmonth) . " AND DAYOFMONTH(bday)=" . S::sqlEscape($nday) . " LIMIT 200"); while ($rt = $db->fetch_array($query)) { $birthnum++; if ($rt['gender'] == 1) { $rt['gender'] = getLangInfo('other', 'men'); } elseif ($rt['gender'] == 2) { $rt['gender'] = getLangInfo('other', 'women'); } else { $rt['gender'] = ''; } $rt['username'] = S::escapeChar($rt['username']); $rt['age'] = $nyear - substr($rt['bday'], 0, strpos($rt['bday'], '-')); $brithcache .= ' <span><a target="_blank" class=" _cardshow" data-card-url="pw_ajax.php?action=smallcard&type=showcard&username='******'" data-card-key=' . $rt[username] . ' href="u.php?username='******'username']) . "\" title=\"{$rt['username']}{$rt['gender']}" . getLangInfo('other', 'indexbirth', array('age' => $rt['age'])) . "\">{$rt['username']}</a></span>"; } pwCache::writeover($cachefile, "<?php\r\n\$birthnum=" . pw_var_export($birthnum) . ";\r\n\$brithcache=" . pw_var_export($brithcache) . ";\r\n?>"); procUnLock('birth'); } else { include_once $cachefile; } $db_bdayautohide && !$brithcache && ($brithcache = 'empty');
} $userdb = "{$pre} <a href='{$db_bbsurl}/{$value['url']}' target='_blank'>{$value['title']}</a> {$useradd}"; $userdb = str_replace('"', '\\"', $userdb); $newlist .= "document.write(\"{$userdb}<br>\");\n"; } pwCache::writeover($cachefile, $newlist); procUnLock('new_js_member'); echo $newlist; } else { @readfile($cachefile); } break; case 'article': S::gp(array('num', 'length', 'fidin', 'fidout', 'postdate', 'author', 'fname', 'hits', 'replies', 'pre', 'digest', 'order')); $cachefile = D_P . "data/bbscache/new_{$action}_" . md5($action . (int) $num . (int) $length . $fidin . $fidout . (int) $postdate . (int) $author . (int) $fname . (int) $hits . (int) $replies . (int) $pre . (int) $digest . (int) $order); if ($timestamp - $per >= pwFilemtime($cachefile) && procLock('new_js_article')) { $num = is_numeric($num) ? $num : 10; $length = is_numeric($length) ? $length : 35; $pre = is_numeric($pre) ? $prefix[$pre] : $prefix[0]; //* $fname && include_once pwCache::getPath(D_P.'data/bbscache/forum_cache.php'); $fname && pwCache::getData(D_P . 'data/bbscache/forum_cache.php'); $orderway = array('1' => 'lastpost', '2' => 'postdate', '3' => 'replies', '4' => 'hits'); $orderby = is_numeric($order) ? $orderway[$order] : $orderway[1]; !$orderby && ($orderby = $orderway[1]); $sqladd = "ifcheck=1"; $fidoff = $ext = ''; $query = $db->query("SELECT fid FROM pw_forums WHERE password!='' OR allowvisit!='' OR f_type='hidden'"); while ($rt = $db->fetch_array($query)) { $fidoff .= $ext . $rt['fid']; !$ext && ($ext = ','); }
$arg .= "{$key}={$value}&"; } } $veryfy_result1 = $_GET['sign'] == md5(substr($arg, 0, -1) . $ol_alipaykey) ? 'true' : 'false'; } if (!eregi("true\$", $veryfy_result1) || !eregi("true\$", $veryfy_result2)) { paymsg($ret_url, 'alipay_failure', 'fail'); } if (empty($action)) { if (!$ol_onlinepay) { Showmsg($ol_whycolse); } if (!$ol_payto) { Showmsg('olpay_seterror'); } if (procLock('alipay', $winduid)) { $rt = $db->get_one('SELECT c.*,m.username,m.groupid,m.groups FROM pw_clientorder c LEFT JOIN pw_members m USING(uid) WHERE order_no=' . S::sqlEscape($out_trade_no)); if (empty($rt)) { procUnLock('alipay', $winduid); paymsg($ret_url, 'alipay_ordersfailure'); } $fee = $rt['number'] * $rt['price']; if ($fee != $_GET['total_fee'] || $_GET['seller_email'] != $ol_payto) { procUnLock('alipay', $winduid); paymsg($ret_url, 'alipay_failure'); } if ($trade_status == 'TRADE_FINISHED' || $trade_status == 'TRADE_SUCCESS') { if ($rt['state'] == 2) { procUnLock('alipay', $winduid); paymsg($ret_url, 'alipay_orderssuccess'); }
} } else { include pwCache::getPath(D_P . "data/bbscache/article_sort.php"); } $cachetime = get_date($cachetime + $per * 3600); $show_url = "read.php?tid"; require PrintEot('sort'); footer(); } elseif ($action == 'team') { /* $lockfile = D_P.'data/bbscache/lock_team.txt'; $fp = fopen($lockfile,'wb+'); flock($fp,LOCK_EX); */ $cachetime = pwFilemtime(D_P . "data/bbscache/team_sort.php"); if ((!$per || $timestamp - $cachetime > $per * 3600) && procLock('sort_team')) { //* include_once pwCache::getPath(D_P.'data/bbscache/level.php'); pwCache::getData(D_P . 'data/bbscache/level.php'); $uids = $gids = array(); $query = $db->query("SELECT gid FROM pw_usergroups WHERE gptype='system' AND gid NOT IN(5,6,7)"); while ($rt = $db->fetch_array($query)) { $gids[] = $rt['gid']; } $teamdb = $tfdb = $fadmindb = $forumdb = $admin_a = $men = array(); $query = $db->query("SELECT fid,forumadmin FROM pw_forums WHERE cms!='1' AND forumadmin!=''"); while ($rt = $db->fetch_array($query)) { $fuids = explode(',', substr($rt['forumadmin'], 1, -1)); foreach ($fuids as $key => $val) { if ($val) { $tfdb[$rt['fid']][] = $val; $admin_a[] = $val;
} else { Showmsg('proclock'); } } elseif ($_POST['action'] == 'draw') { S::gp(array('drawmoney', 'btype'), 'P', 2); if (!is_numeric($drawmoney) || $drawmoney <= 0) { Showmsg('bk_draw_fillin_error'); } $btype != 1 && $btype != 2 && Showmsg('undefined_action'); /* $db->query("LOCK TABLES pw_memberdata WRITE,pw_memberinfo WRITE"); $lockfile = D_P.'data/bbscache/lock_bank.txt'; $fp = fopen($lockfile,'wb+'); flock($fp,LOCK_EX); */ if (procLock('bank_draw', $winduid)) { $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $bankdb = $userService->get($winduid, false, false, true); //deposit,startdate,ddeposit,dstartdate if ($btype == 1) { if ($drawmoney > $bankdb['deposit']) { procUnLock('bank_draw', $winduid); Showmsg('bk_draw_error'); } } else { if ($drawmoney > $bankdb['ddeposit']) { procUnLock('bank_draw', $winduid); Showmsg('bk_draw_error'); } }
/** * 更新在线信息 * @return void */ function updateOnlineInfo() { global $tdtime, $timestamp, $userinbbs, $guestinbbs; $typeid = pwEscape(get_date($this->t, 'G')); $date = pwEscape(get_date($this->t, 'Y-m-d')); $userinbbs = intval($userinbbs); $guestinbbs = intval($guestinbbs); $this->_db->update("REPLACE INTO `pw_statistics_daily` (`name`,`typeid`,`date`,`value`,`updatetime`)\n\t\t\t\tVALUES('userinbbs',{$typeid},{$date},{$userinbbs},{$this->t}),\n\t\t\t\t('guestinbbs',{$typeid},{$date},{$guestinbbs},{$this->t})\n\t\t\t"); $lastday = pwEscape(get_date($tdtime - 86400, 'Y-m-d')); $this->_db->update("DELETE FROM `pw_statistics_daily` WHERE (name='userinbbs' OR name='guestinbbs') AND `date`<{$lastday}"); //$this->_db->update("UPDATE `pw_bbsinfo` SET `last_statistictime`=$this->t WHERE id=1"); pwQuery::update('pw_bbsinfo', 'id=:id', array(1), array('last_statistictime' => $this->t)); /*归总前日登录数*/ if (procLock('statisticLogin')) { $query = $this->_db->query("SELECT COUNT(`typeid`) AS `value`,`date` FROM `pw_statistics_daily` \n\t\t\t\tWHERE name='login' AND `typeid`>0 AND `date`<'{$this->day}'\n\t\t\t\tGROUP BY `date`"); $logins = array(); while ($rt = $this->_db->fetch_array($query)) { $rt['typeid'] = 0; $rt['name'] = 'login'; $rt['updatetime'] = $timestamp; $logins[$rt['date']] = $rt; } $cnt = count($logins); if ($cnt > 0) { $this->_db->update("REPLACE INTO `pw_statistics_daily` (`value`,`date`,`typeid`,`name`,`updatetime`) VALUE " . pwSqlMulti($logins)); $this->_db->affected_rows() == $cnt && $this->_db->query("DELETE FROM `pw_statistics_daily` WHERE `name`='login' AND `date`<'{$this->day}' AND `typeid`>0"); } procUnLock('statisticLogin'); } }
/** * 更新可视化页面的静态文件 * @param $sign */ function portalStatic($sign, $_viewer = '', $name = '') { $portalPageService = L::loadClass('portalpageservice', 'area'); if (!$portalPageService->checkPortal($sign)) { if ($name) { $portalPageService->addPortalPage(array('sign' => $sign, 'title' => $name)); } else { Showmsg('函数portalEcho调用出错,请设置本函数的第三个参数,定义该调用页面的名称'); } } $lockName = 'portal_' . $sign; if (!procLock($lockName)) { return false; } $staticPath = S::escapePath(PORTAL_PATH . $sign); if (!is_dir($staticPath)) { return false; } $staticPath = S::escapePath(PORTAL_PATH . $sign . '/index.html'); $otherOutput = ob_get_contents(); ob_clean(); $invokeService = L::loadClass('invokeservice', 'area'); $pageConfig = $invokeService->getEffectPageInvokePieces('other', $sign); $tplGetData = L::loadClass('tplgetdata', 'area'); $tplGetData->init($pageConfig); require portalEot($sign); $temp = ob_get_contents(); $temp = str_replace(array('<!--<!---->', "<!---->\r\n", '<!---->', '<!-- -->', "\t\t\t"), '', $temp); //$success = pwCache::writeover($staticPath, $temp,'wb+'); $success = pwCache::setData($staticPath, $temp, false, 'wb+'); procUnLock($lockName); if (!$success && !$GLOBALS['db_distribute'] && !pwCache::writeover($staticPath, $temp) && !is_writable($staticPath)) { //写入二次尝试 ob_end_clean(); ObStart(); Showmsg('请设置' . str_replace(R_P, '', $staticPath) . '文件为可写,如果文件不存在,则新建一个空文件'); } ob_clean(); $portalPageService->setPortalStaticState($sign, 0); updateCacheData(); setPortalHtmlTime($sign); if ($otherOutput) { echo $otherOutput; } }
//每日打卡 if ($step == 2) { //* include_once pwCache::getPath(D_P . 'data/bbscache/o_config.php'); pwCache::getData(D_P . 'data/bbscache/o_config.php'); if (!$o_punchopen) { ajaxResponse('打卡功能已经关闭', false); } $usergroup = $o_punch_usergroup ? explode(",", $o_punch_usergroup) : array(); if ($usergroup && !in_array($groupid, $usergroup)) { ajaxResponse('您所在用户组没有打卡的权限', false); } list($todayStart, $todayEnd) = array($tdtime, $tdtime + 86400); if ($winddb['punch'] > $todayStart && $winddb['punch'] < $todayEnd) { ajaxResponse('你已经打卡,请明天再试', false); } if (procLock('punch_save', $winduid)) { if (pwQuery::update('pw_memberdata', 'uid=:uid', array($winduid), array('punch' => $timestamp))) { list($bool, $information, $continues) = getPunchReward($o_punch_reward); } } procUnLock('punch_save', $winduid); if ($bool) { ajaxResponse("{$information}\t{$continues}", true); } else { ajaxResponse('打卡失败,请明天继续!', false); } } } else { } function ajaxResponse($message, $flag, $html = '') {