コード例 #1
0
ファイル: job.class.php プロジェクト: sherlockhouse/aliyun
 function _unlockUserJob($userId, $returnData)
 {
     procUnLock('job_save', $userId);
     return $returnData;
 }
コード例 #2
0
ファイル: toolcenter.php プロジェクト: sherlockhouse/aliyun
                if (array_key_exists($toolinfo['creditype'], $db_creditpay)) {
                    procUnLock('tool_buy', $winduid);
                    Showmsg('unenough_currency');
                } else {
                    procUnLock('tool_buy', $winduid);
                    Showmsg('unenough_money');
                }
            }
            $credit->addLog('hack_toolbuy', array($toolinfo['creditype'] => -$price), array('uid' => $winduid, 'username' => $windid, 'ip' => $onlineip, 'nums' => $nums, 'toolname' => $toolinfo['name']));
            $credit->set($winduid, $toolinfo['creditype'], -$price);
            $db->update("UPDATE pw_tools SET stock=stock-" . S::sqlEscape($nums) . " WHERE id=" . S::sqlEscape($id));
            $db->pw_update("SELECT uid FROM pw_usertool WHERE uid=" . S::sqlEscape($winduid) . " AND toolid=" . S::sqlEscape($id), "UPDATE pw_usertool SET nums=nums+" . S::sqlEscape($nums) . " WHERE uid=" . S::sqlEscape($winduid) . " AND toolid=" . S::sqlEscape($id), "INSERT INTO pw_usertool SET " . S::sqlSingle(array('nums' => $nums, 'uid' => $winduid, 'toolid' => $id, 'sellstatus' => $sell_status)));
            require_once R_P . 'require/tool.php';
            $logdata = array('type' => 'buy', 'nums' => $nums, 'money' => $price, 'descrip' => 'buy_descrip', 'uid' => $winduid, 'username' => $windid, 'ip' => $onlineip, 'time' => $timestamp, 'toolname' => $toolinfo['name'], 'from' => '');
            writetoollog($logdata);
            procUnLock('tool_buy', $winduid);
        }
        refreshto("profile.php?action=toolcenter", 'operate_success');
    }
} elseif ($job == 'use' || $job == 'ajax') {
    $toolid = (int) S::getGP('toolid');
    if (!$toolid) {
        $tooldb = array();
        $query = $db->query("SELECT * FROM pw_usertool u LEFT JOIN pw_tools t ON t.id=u.toolid WHERE u.uid=" . S::sqlEscape($winduid) . "ORDER BY vieworder");
        while ($rt = $db->fetch_array($query)) {
            $rt['descrip'] = substrs($rt['descrip'], 45);
            $tooldb[] = $rt;
        }
        if (!$tooldb) {
            Showmsg('no_tool');
        }
コード例 #3
0
ファイル: birth.php プロジェクト: jechiy/PHPWind
<?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');
コード例 #4
0
ファイル: index.php プロジェクト: jechiy/PHPWind
// 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();
コード例 #5
0
ファイル: alipay.php プロジェクト: sherlockhouse/aliyun
            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');
            }
            if (file_exists(R_P . "require/olpay/pay_{$rt[type]}.php")) {
                require_once S::escapePath(R_P . "require/olpay/pay_{$rt[type]}.php");
            }
            $db->update("UPDATE pw_clientorder SET payemail=" . S::sqlEscape($buyer_email) . ",state=2 WHERE order_no=" . S::sqlEscape($out_trade_no));
            procUnLock('alipay', $winduid);
            paymsg($ret_url, 'alipay_orderssuccess');
        } else {
            procUnLock('alipay', $winduid);
            paymsg($ret_url, 'alipay_topayfailure');
        }
    } else {
        Showmsg('proclock');
    }
} elseif ($action == 'trade') {
    $rt = $db->get_one("SELECT tid,ifpay FROM pw_tradeorder WHERE order_no=" . S::sqlEscape($out_trade_no));
    if (empty($rt) || $rt['ifpay'] == '3') {
        paymsg('index.php', 'alipay_ordersfailure');
    }
    switch ($trade_status) {
        case 'WAIT_SELLER_SEND_GOODS':
            $db->update("UPDATE pw_tradeorder SET ifpay='1',tradedate=" . S::sqlEscape($timestamp) . ",payment='2' WHERE order_no=" . S::sqlEscape($out_trade_no));
            break;
        case 'WAIT_BUYER_CONFIRM_GOODS':
コード例 #6
0
ファイル: userpay.php プロジェクト: sherlockhouse/aliyun
            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);
    }
}
コード例 #7
0
ファイル: new.php プロジェクト: sherlockhouse/aliyun
                $threads['subject'] = substrs($threads['subject'], $length);
                $article = "{$pre} <a href='{$db_bbsurl}/read.php?tid={$threads['tid']}' target='_blank'>{$threads['subject']}</a> ";
                if ($postdate) {
                    $article .= " <font color='{$color}'>(" . get_date($threads['postdate'], "Y-m-d H:i") . ')</font>';
                }
                if ($author) {
                    $article .= " <a href='{$db_bbsurl}/" . USER_URL . "{$threads['authorid']}' target='_blank'><font color='{$color}'>({$threads['author']})</font></a>";
                }
                if ($replies) {
                    $article .= " <font color='{$color}'>(" . getLangInfo('other', 'js_replies') . ":{$threads['replies']})</font></a>";
                }
                if ($hits) {
                    $article .= " <font color='{$color}'>(" . getLangInfo('other', 'js_hits') . ":{$threads['hits']})</font></a>";
                }
                if ($fname) {
                    $article .= " <a href='{$db_bbsurl}/thread.php?fid={$threads['fid']}' target='_blank'><font color='{$color}'>(" . $forum[$threads['fid']]['name'] . ")</font></a>";
                }
                $article = str_replace('"', '\\"', $article);
                $newlist .= "document.write(\"{$article}<br>\");\n";
            }
            pwCache::writeover($cachefile, $newlist);
            procUnLock('new_js_article');
            echo $newlist;
        } else {
            @readfile($cachefile);
        }
        break;
    default:
        $showmsg = getLangInfo('other', 'js_close');
        exit("document.write(\"{$showmsg}\");");
}
コード例 #8
0
ファイル: job.class.php プロジェクト: adi00/wumaproject
 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 array(false, "抱歉,你还没有申请这个任务");
         }
         /*检查是否是一次性任务或完成*/
         if (!$job['period'] && $jober['total'] > 1) {
             return 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 array(true, "抱歉,任务没有在规定的时间内完成");
         }
         /*任务时间限制 end */
         if ($factor) {
             if ($jober['status'] < 2) {
                 return array(true, "抱歉,你还没有完成任务");
             }
             if ($jober['status'] > 3) {
                 return array(true, "抱歉,数据错误,请重试");
             }
         }
         if ($jober['status'] == 3) {
             return array(true, "抱歉,你已经领取过奖励,不能重复领取");
         }
         $data = array();
         $data['status'] = 3;
         /*任务完成*/
         $data['total'] = $jober['total'] + 1;
         $data['next'] = $next;
         $result = $this->updateJober($data, $jober['id']);
         if (!$result) {
             return array(false, "抱歉,领取奖励失败,请重试");
         }
         if (isset($job['reward'])) {
             $this->jobRewardHandler($userid, $job);
         }
         $this->reduceJobNum($userid);
         /*任务完成*/
         $information = $this->getCategoryInfo($job['reward']);
         procUnLock('job_save', $userid);
         $information = $information ? "," . $information : "";
         return array(true, "恭喜你完成任务" . $information);
     }
 }
コード例 #9
0
ファイル: sort.php プロジェクト: jechiy/PHPWind
            $query = $db->query("SELECT COUNT(*) AS post,SUM(hits) AS count,authorid FROM pw_threads WHERE postdate>" . S::sqlEscape($montime) . " AND authorid IN({$uids}) GROUP BY authorid");
            while ($rt = $db->fetch_array($query)) {
                $fadmindb[$rt['authorid']]['hits'] = $rt['count'];
                $fadmindb[$rt['authorid']]['post'] = $rt['post'];
            }
        }
        foreach ($tfdb as $fid => $value) {
            foreach ($fadmindb as $key => $val) {
                if (in_array($val['username'], $value)) {
                    $forumdb[$fid][$val['uid']] = $val;
                }
            }
        }
        pwCache::setData(D_P . 'data/bbscache/team_sort.php', "<?php\r\n\$teamdb=" . pw_var_export($teamdb) . ";\r\n\$forumdb=" . pw_var_export($forumdb) . ";\n?>");
        touch(D_P . 'data/bbscache/team_sort.php');
        procUnLock('sort_team');
    } else {
        //* include pwCache::getPath(D_P.'data/bbscache/team_sort.php');
        pwCache::getData(D_P . 'data/bbscache/team_sort.php');
    }
    //fclose($fp);
    $cachetime = get_date($cachetime + $per * 3600);
    //* include_once pwCache::getPath(D_P.'data/bbscache/forum_cache.php');
    pwCache::getData(D_P . 'data/bbscache/forum_cache.php');
    require PrintEot('sort');
    footer();
} elseif ($action == 'admin') {
    $baseurl = 'sort.php?action=admin';
    S::gp(array('postStartDate', 'postEndDate', 'adminName', 'type', 'step'));
    $monthFile = S::escapePath(D_P . "data/bbscache/admin_sort_" . $montime . ".php");
    if (file_exists($monthFile)) {
コード例 #10
0
ファイル: index.php プロジェクト: sherlockhouse/aliyun
    $to_bankdb = $userService->get($userdb['uid'], false, false, true);
    //deposit,startdate
    if ($needmoney <= $bankdb['deposit']) {
        bankdraw($winduid, $needmoney, $bankdb, 1);
    } else {
        bankdraw($winduid, $bankdb['deposit'], $bankdb, 1);
        bankdraw($winduid, $needmoney - $bankdb['deposit'], $bankdb, 2);
    }
    banksave($userdb['uid'], $to_money, $to_bankdb, 1);
    //fclose($fp);
    //$db->query("UNLOCK TABLES");
    M::sendNotice(array($pwuser), array('title' => getLangInfo('writemsg', 'virement_title'), 'content' => getLangInfo('writemsg', 'virement_content', array('windid' => $windid, 'to_money' => $to_money, 'memo' => stripslashes($memo)))));
    require_once R_P . 'require/writelog.php';
    $log = array('type' => 'bk_vire', 'username1' => $windid, 'username2' => $pwuser, 'field1' => $to_money, 'field2' => $winduid, 'field3' => $userdb['uid'], 'descrip' => 'bk_vire_descrip', 'timestamp' => $timestamp, 'ip' => $onlineip);
    writeforumlog($log);
    procUnLock('bank_virement', $winduid);
    refreshto($basename, 'bank_viresuccess');
    //} else {
    //	Showmsg('proclock');
    //}
} elseif ($action == 'log') {
    require_once GetLang('logtype');
    S::gp(array('type', 'page', 'to'));
    $sqladd = '';
    $select = array();
    if ($type && in_array($type, array('bk_save', 'bk_draw', 'bk_vire'))) {
        $sqladd = " AND type=" . S::sqlEscape($type);
        $select[$type] = "selected";
    }
    (!is_numeric($page) || $page < 1) && ($page = 1);
    $sqlfiled = $to ? 'username2' : 'username1';
コード例 #11
0
ファイル: statistics.class.php プロジェクト: jechiy/PHPWind
 /**
  * 更新在线信息
  * @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');
     }
 }
コード例 #12
0
ファイル: common.php プロジェクト: jechiy/PHPWind
/**
 * 更新可视化页面的静态文件
 * @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;
    }
}
コード例 #13
0
ファイル: jobcenter.php プロジェクト: jechiy/PHPWind
            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 = '')
{
    echo '[{"message":\'' . $message . '\',"flag":\'' . $flag . '\',"html":\'' . $html . '\'}]';
    ajax_footer();
}
/*
 * 打卡领取奖励