function invokeApiFileEot($id)
 {
     $file = $this->getInvokeApiFile($id);
     if (!file_exists($file)) {
         writeover($file, "<?php\r\nprint <<<EOT\r\n" . $invokeInfo['parsecode'] . "\r\nEOT;\r\n?>");
     }
 }
示例#2
0
function config()
{
    global $db, $imgpath, $db_bbsurl;
    $content .= "\$cheatopen=\"0\";\r\n";
    $content .= "\$cheatopenmsg=\"管理员把去探宝的地图弄丢啦,快去找他要\";\r\n";
    $content .= "\$fish_groups=\",3,4,5,8,16,9,10,11,12,13,14,15,\";\r\n";
    $content .= "\$guestview=\"0\";\r\n";
    $content .= "\$fish1money=\"10\";\r\n";
    $content .= "\$fish2money=\"50\";\r\n";
    $content .= "\$fish3money=\"50\";\r\n";
    $content .= "\$fish4money=\"30\";\r\n";
    $content .= "\$fish5money=\"30\";\r\n";
    $content .= "\$fish6money=\"20\";\r\n";
    $content .= "\$fish7money=\"20\";\r\n";
    $content .= "\$fish8money=\"20\";\r\n";
    $content .= "\$fish9money=\"20\";\r\n";
    $content .= "\$fish10money=\"20\";\r\n";
    $content .= "\$fish11money=\"20\";\r\n";
    $content .= "\$fish12money=\"20\";\r\n";
    $content .= "\$fish13money=\"20\";\r\n";
    $content .= "\$fish14money=\"20\";\r\n";
    $content .= "\$vtime=\"1\";\r\n";
    $content .= "\$cview=\"0\";\r\n";
    $content .= "\$cutime=\"20\";";
    writeover(D_P . "data/bbscache/fish/config.php", "<?php\r\n" . $content . "\r\n?>");
}
示例#3
0
function area_static_deal($op, $params = array())
{
    global $area_static_ifon, $area_static_next, $area_static_step;
    global $timestamp, $db_htmdir, $area_need_dynamic, $area_refresh_static;
    $area_data_file = R_P . $db_htmdir . '/area_index.htm';
    if ($op == "isNeedDynamic") {
        $area_need_dynamic = isset($_GET['getdynamic']) && $_GET['getdynamic'];
        if (!$area_static_ifon) {
            $area_need_dynamic = true;
        }
        return $area_need_dynamic;
    } elseif ($op == "getStaticContent") {
        if ($area_need_dynamic) {
            return;
        }
        $area_refresh_static = $timestamp >= $area_static_next || !file_exists($area_data_file);
        if ($area_refresh_static) {
            $area_need_dynamic = true;
        } else {
            $area_index_content = file_get_contents($area_data_file);
            if ('' == $area_index_content) {
                $area_need_dynamic = true;
            }
        }
        return $area_index_content;
    } elseif ($op == "saveStaticContent") {
        if ("" == $params['content']) {
            return;
        }
        writeover($area_data_file, $params['content']);
        updateAreaStaticRefreshTime($timestamp + $area_static_step * 60);
    }
}
示例#4
0
 /**
  * 下载一个远程文件
  * @param string $url
  */
 function download($url, $bhv)
 {
     if (!$url || !PwDownload::checkUrl($url)) {
         return false;
     }
     $filetype = PwDownload::getFileExt($url);
     $filename = PwDownload::getFileName($url);
     if (!$filetype || !$filename) {
         return false;
     }
     //文件类型判定
     if (!$filetype || !isset($bhv->ftype[$filetype])) {
         return false;
     }
     $fileContent = PwDownload::getContents($url);
     //文件尺寸判定
     $fileSize = strlen($fileContent);
     if ($fileSize < 1 || $fileSize > $bhv->ftype[$filetype] * 1024) {
         unset($fileContent, $fileSize);
         return false;
     }
     //init
     $array = array('id' => 0, 'attname' => 'download', 'name' => $filename, 'size' => intval($fileSize), 'type' => 'zip', 'ifthumb' => 0, 'fileuploadurl' => '', 'ext' => $filetype);
     //保存
     list($saveFilename, $saveDir) = $bhv->getFilePath($array);
     $source = PwUpload::savePath($bhv->ifftp, $saveFilename, $saveDir);
     $tmpname = tempnam(DOWNLOAD_TEMP_PATH, DOWNLOAD_FILE_PREFIX);
     writeover($tmpname, $fileContent);
     if (!PwDownload::downloadMove($tmpname, $source)) {
         showUploadMsg('upload_error');
     }
     $array['fileuploadurl'] = $saveDir . $saveFilename;
     PwUpload::operateAttach($source, $saveFilename, $saveDir, $array, $bhv);
     return $array;
 }
 function getByTid($tid)
 {
     global $attachpath, $db_windpost, $foruminfo, $fid, $forumset, $pwforum, $db_hits_store;
     $tid = intval($tid);
     if ($tid <= 0) {
         return $this->buildResponse(THREAD_INVALID_PARAMS);
     }
     $GLOBALS['tid'] = $tid;
     $threadData = $this->_getThread($tid, true);
     if (empty($threadData)) {
         return $this->buildResponse(0);
     }
     $fid = $threadData['fid'];
     $user = $this->getCurrentUser();
     $user->initRight();
     $this->getCustomizedCommonService()->getReadRight($user);
     $GLOBALS['tpc_buy'] = $threadData['buy'];
     $GLOBALS['tpc_author'] = $threadData['author'];
     L::loadClass('forum', 'forum', false);
     $pwforum = new PwForum($fid);
     $foruminfo = $pwforum->foruminfo;
     $forumset = $pwforum->forumset;
     list($windVersion) = explode(',', WIND_VERSION);
     if ($windVersion == '8.0') {
         $threadData = $this->_isMyFavoredForEarly($tid, $threadData);
     } else {
         $threadData = $this->_isMyFavoredForAfter($tid, $threadData);
     }
     $udb = $this->_getUDb($threadData);
     $bandb = $pwforum->forumBan($udb);
     isset($bandb[$threadData['uid']]) && ($threadData['groupid'] = 6);
     $_attachList = array();
     if ($threadData['aid']) {
         $query = $GLOBALS['db']->query('SELECT * FROM pw_attachs WHERE tid=' . pwEscape($tid) . ' AND pid=0');
         while ($rt = $GLOBALS['db']->fetch_array($query)) {
             $_attachList[] = $rt;
         }
     }
     $imgsInContent = $this->getCustomizedCommonService()->parseImgInContent($threadData);
     $threadData['content'] = $this->getCustomizedCommonService()->parsePostContent($threadData);
     $threadData['content'] = $this->getCustomizedCommonService()->clearHtmlTag($threadData['content'], '<br>');
     $threadData['content'] = $this->getCustomizedCommonService()->parseEmotionInContent($threadData['content']);
     $threadData['attachlist'] = $this->getCustomizedCommonService()->getAttachWithThumblist($_attachList);
     $threadData['attachlist'] = array_merge($imgsInContent, $threadData['attachlist']);
     $this->getCustomizedCommonService()->clearAttachSign($_attachList, &$threadData['content']);
     $threadData['icon'] = $this->getCustomizedCommonService()->getUserIcon($threadData['icon']);
     if ($db_hits_store == 0) {
         $GLOBALS['db']->update('UPDATE pw_threads SET hits=hits+1 WHERE tid=' . pwEscape($tid));
     } elseif ($db_hits_store == 1) {
         $GLOBALS['db']->update('UPDATE pw_hits_threads SET hits=hits+1 WHERE tid=' . pwEscape($tid));
     } elseif ($db_hits_store == 2) {
         if (class_exists("pwCache") && method_exists("pwCache", "writeover")) {
             pwCache::writeover(D_P . 'data/bbscache/hits.txt', $tid . "\t", 'ab');
         } else {
             writeover(D_P . 'data/bbscache/hits.txt', $tid . "\t", 'ab');
         }
     }
     return $this->buildResponse(0, $threadData);
 }
 function _writeover()
 {
     $this->_keyword = trim($this->_filterCheckKeyword($this->_keyword));
     if (!$this->_keyword) {
         return false;
     }
     writeover($this->_filePath, $this->_parsetxt($this->_keyword), 'ab+');
     return true;
 }
示例#7
0
 function generate($rss_path)
 {
     $all = $this->rssHeader;
     $all .= $this->rssChannel;
     $all .= $this->rssImage;
     $all .= $this->rssItem;
     $all .= "</channel></rss>";
     writeover($rss_path, $all);
 }
示例#8
0
 function dblog($msg)
 {
     $msg = str_replace(array("\n", "\r", "<"), array('', '', '&lt;'), $msg);
     if (file_exists(D_P . 'data/bbscache/dblog.php')) {
         writeover(D_P . 'data/bbscache/dblog.php', "{$msg}\n", 'ab');
     } else {
         writeover(D_P . 'data/bbscache/dblog.php', "<?php die;?>\n{$msg}\n");
     }
 }
示例#9
0
文件: admin.php 项目: winddramon/dts
function adminlog($op, $an1 = '', $an2 = '', $an3 = '')
{
    global $now, $cuser;
    $alfile = GAME_ROOT . './gamedata/adminlog.php';
    if ($op) {
        $aldata = "{$now},{$cuser},{$op},{$an1},{$an2},{$an3},\n";
        writeover($alfile, $aldata, 'ab+');
    }
    return;
}
示例#10
0
function updatemedal_list()
{
    global $db;
    $query = $db->query("SELECT uid FROM pw_medaluser GROUP BY uid");
    $medaldb = '<?php die;?>0';
    while ($rt = $db->fetch_array($query)) {
        $medaldb .= ',' . $rt['uid'];
    }
    writeover(D_P . 'data/bbscache/medals_list.php', $medaldb);
}
示例#11
0
function writeover_array($file, $arr)
{
    $s = '';
    $in = sizeof($arr);
    for ($i = 0; $i < $in; $i++) {
        if (strlen($arr[$i]) > 4) {
            $s .= $arr[$i] . "\n";
        }
    }
    $s = str_replace("\n\n", "\n", $s);
    writeover($file, $s);
}
示例#12
0
function updatecache_bg()
{
    global $db;
    $query = $db->query("SELECT * FROM pw_hack WHERE hk_name LIKE 'bg_%'");
    $blogdb = "<?php\r\n";
    while (@extract($db->fetch_array($query))) {
        $hk_name = key_cv($hk_name);
        $blogdb .= "\${$hk_name}=" . pw_var_export($hk_value) . ";\r\n";
    }
    $blogdb .= "\n?>";
    writeover(D_P . 'data/bbscache/bg_config.php', $blogdb);
}
示例#13
0
 function copyFile($source, $dest)
 {
     if (@copy($source, $dest)) {
         return true;
     }
     if (is_readable($source)) {
         writeover($dest, readover($source));
         if (file_exists($dest)) {
             return true;
         }
     }
     return false;
 }
示例#14
0
 function appsUpdateCache($apps)
 {
     $filename = "data/bbscache/apps_list_cache.php";
     if ($apps && is_array($apps)) {
         $cache = "<?php\r\n\$appsdb=";
         $cache .= pw_var_export($apps);
         $cache .= ";\r\n?>";
         writeover(D_P . $filename, $cache);
         return new ApiResponse(true);
     } else {
         return new ApiResponse(false);
     }
 }
示例#15
0
function get_title($t, $n)
{
    global $gamecfg, $name, $db, $tablepre;
    require config("gamecfg", $gamecfg);
    $result = $db->query("SELECT nicks FROM {$tablepre}users WHERE username = '******'");
    $k = $db->result($result, 0);
    if (strpos($k, $t) === false) {
        $cf = GAME_ROOT . './gamedata/clearlog.php';
        $d = "{$n}" . ',' . "{$t}\n";
        writeover($cf, $d, 'ab+');
        $k = $k . '/' . $t;
    }
    $db->query("UPDATE {$tablepre}users SET nicks='{$k}' WHERE username='******'");
}
示例#16
0
function update_index_forum($config)
{
    global $m;
    @(include_once D_P . 'data/bbscache/mode_' . $m . '_index_forum.php');
    foreach ($index_forum as $key => $value) {
        $config_fids = array_keys($config);
        if (!in_array($key, $config_fids)) {
            unset($index_forum[$key]);
            continue;
        }
        foreach ($value as $k => $v) {
            if (!in_array($k, $config[$key])) {
                unset($index_forum[$key][$k]);
            }
        }
    }
    writeover(Pcv(D_P . 'data/bbscache/mode_' . $m . '_index_forum.php'), "<?php\r\n\$index_forum=" . pw_var_export($index_forum) . ";\r\n?>");
}
示例#17
0
 function mailmx($email, $retrys = 3)
 {
     global $timestamp;
     $domain = substr($email, strpos($email, '@') + 1);
     @(include D_P . 'data/bbscache/mx_config.php');
     if (!$_MX[$domain] || $timestamp - pwFilemtime(D_P . 'data/bbscache/mx_config.php') > 3600 * 24 * 10) {
         for ($i = 0; $i < $retrys; $i++) {
             $result = $this->GetMax($domain);
             if ($result !== false) {
                 $_MX[$domain] = $result;
                 writeover(D_P . 'data/bbscache/mx_config.php', "<?php\r\n\$_MX=" . pw_var_export($_MX) . ";\r\n?>");
                 $this->smtp['tomx'] = $result;
                 return true;
             }
         }
         return false;
     } else {
         $this->smtp['tomx'] = $_MX[$domain];
         return true;
     }
 }
示例#18
0
function creatguestcache($output)
{
    global $fid, $tid, $timestamp, $db_guestdir, $page;
    switch (SCR) {
        case 'thread':
            if (!is_dir(D_P . "{$db_guestdir}/T_{$fid}")) {
                @mkdir(D_P . "{$db_guestdir}/T_{$fid}");
                @chmod(D_P . "{$db_guestdir}/T_{$fid}", 0777);
            }
            writeover(D_P . "{$db_guestdir}/T_{$fid}/{$fid}_{$page}.html", $output);
            break;
        case 'read':
            $tmp = 'R_' . intval($tid / 500);
            if (!is_dir(D_P . "{$db_guestdir}/{$tmp}")) {
                @mkdir(D_P . "{$db_guestdir}/{$tmp}");
                @chmod(D_P . "{$db_guestdir}/{$tmp}", 0777);
            }
            writeover(D_P . "{$db_guestdir}/{$tmp}/{$tid}_{$page}.html", $output);
            break;
        case 'index':
            writeover(D_P . "{$db_guestdir}/index.html", $output);
            break;
    }
}
示例#19
0
function write_config($newconfig = array())
{
    global $tplpath;
    if (!empty($newconfig) && is_array($newconfig)) {
        foreach ($newconfig as $key => $value) {
            ${$key} = $value;
        }
    } else {
        include D_P . 'data/sql_config.php';
    }
    $db_hostweb != 0 && ($db_hostweb = 1);
    !$pconnect && ($pconnect = 0);
    $att_url = $mg_a = $mg_p = '';
    foreach ($manager as $value) {
        $mg_a .= ",'{$value}'";
    }
    foreach ($manager_pwd as $value) {
        $mg_p .= ",'{$value}'";
    }
    foreach ($attach_url as $value) {
        $att_url .= ",'{$value}'";
    }
    $mg_a = substr($mg_a, 1);
    $mg_p = substr($mg_p, 1);
    $att_url = substr($att_url, 1);
    if (file_exists(R_P . "template/admin_{$tplpath}")) {
        include R_P . "template/admin_{$tplpath}/cp_lang_all.php";
    } else {
        include R_P . "template/admin/cp_lang_all.php";
    }
    foreach (array('sqlinfo', 'dbhost', 'dbuser', 'dbname', 'database', 'PW', 'pconnect', 'charset', 'managerinfo', 'managername', 'hostweb', 'attach_url') as $I) {
        eval('$lang[\'all\'][' . $I . ']="' . addcslashes($lang['all'][$I], '"') . '";');
    }
    $writetofile = "<?php\r\n/**\r\n{$lang[all][sqlinfo]}\r\n*/\r\n\t{$lang[all][dbhost]}\r\n\$dbhost = '{$dbhost}';\r\n\r\n\t{$lang[all][dbuser]}\r\n\$dbuser = '******';\r\n\$dbpw = '{$dbpw}';\r\n\r\n\t{$lang[all][dbname]}\r\n\$dbname = '{$dbname}';\r\n\r\n\t{$lang[all][database]}\r\n\$database = '{$database}';\r\n\r\n\t{$lang[all][PW]}\r\n\$PW = '{$PW}';\r\n\r\n\t{$lang[all][pconnect]}\r\n\$pconnect = '{$pconnect}';\r\n\r\n/**\r\n{$lang[all][charset]}\r\n*/\r\n\$charset = '{$charset}';\r\n\r\n/**\r\n{$lang[all][managerinfo]}\r\n*/\r\n\t{$lang[all][managername]}\r\n\$manager = array({$mg_a});\r\n\r\n\t{$lang[all][managerpwd]}\r\n\$manager_pwd = array({$mg_p});\r\n\r\n/**\r\n{$lang[all][hostweb]}\r\n*/\r\n\$db_hostweb = '{$db_hostweb}';\r\n\r\n/**\r\n{$lang[all][attach_url]}\r\n*/\r\n\$attach_url = array({$att_url});\r\n" . '?>';
    writeover(D_P . 'data/sql_config.php', $writetofile);
}
示例#20
0
function attachcheck($file)
{
    global $cache_file, $attachdir, $admin_pwd, $filename, $filesize, $ifless, $postdate1, $postdate2, $direct, $attachdir;
    if ($filename && strpos($file, $filename) === false) {
        return;
    }
    if ($filesize) {
        if ($ifless && filesize("{$attachdir}/{$file}") >= $filesize * 1024) {
            return;
        } elseif (!$ifless && filesize("{$attachdir}/{$file}") <= $filesize * 1024) {
            return;
        }
    }
    if ($postdate1) {
        $visittime = PwStrtoTime($postdate1);
        if (is_numeric($visittime) && fileatime("{$attachdir}/{$file}") < $visittime) {
            return;
        }
    }
    if ($postdate2) {
        $visittime = PwStrtoTime($postdate2);
        if (is_numeric($visittime) && fileatime("{$attachdir}/{$file}") > $visittime) {
            return;
        }
    }
    if ($_POST['direct']) {
        P_unlink("{$attachdir}/{$file}");
        P_unlink("{$attachdir}/thumb/{$file}");
    } else {
        strlen($file) > 49 && ($file = substr($file, 0, 49));
        writeover($cache_file, str_pad($file, 49) . "\n", "ab");
        //* pwCache::setData($cache_file,str_pad($file,49)."\n", false, "ab");
    }
}
示例#21
0
 /**
  * 写入登陆错误日志
  * @param <type> $username
  * @param <type> $password
  */
 public function log_error_login($username, $password)
 {
     $admin_recordfile = PATH_ADMIN . "/data/log/admin_log.php";
     $onlineip = get_client_ip();
     $new_record = "<?die;?>|{$username}|{$password}|Logging Failed|{$onlineip}|" . time() . "|\n";
     //登陆次数限制
     writeover($admin_recordfile, $new_record, "ab");
 }
示例#22
0
 function updateIcon($uid)
 {
     global $atc_attachment_name, $db_ifftp;
     $uid = intval($uid);
     if ($uid < 1 || !S::isArray($_FILES)) {
         return $this->buildResponse(USER_INVALID_PARAMS);
     }
     ACloud_Sys_Core_Common::setGlobal('customized_current_uid', $uid);
     $user = $this->getCurrentUser();
     if (!$user->isLogin()) {
         return $this->buildResponse(USER_NOT_LOGIN);
     }
     $ext = strtolower(substr(strrchr($_FILES['icon']['name'], '.'), 1));
     L::loadClass('faceupload', 'upload', false);
     $face = new FaceUpload($user->uid);
     $icondb = PwUpload::upload($face);
     require_once R_P . 'require/showimg.php';
     $udir = str_pad(substr($user->uid, -2), 2, '0', STR_PAD_LEFT);
     if (!in_array(strtolower($ext), array('gif', 'jpg', 'jpeg', 'png', 'bmp'))) {
         return $this->buildResponse(USER_UPLOAD_CONTENT_ERROR);
     }
     $filename = "{$user->uid}.{$ext}";
     $sourceFilename = "{$user->uid}_tmp.{$ext}";
     $sourceDir = "upload/{$udir}/";
     $middleDir = "upload/middle/{$udir}/";
     $smallDir = "upload/small/{$udir}/";
     $img_w = $img_h = 0;
     $sourceFile = PwUpload::savePath($db_ifftp, $sourceFilename, $sourceDir);
     $middleFile = PwUpload::savePath($db_ifftp, $filename, $middleDir);
     PwUpload::createFolder(dirname($middleFile));
     PwUpload::movefile($sourceFile, $middleFile);
     require_once R_P . 'require/imgfunc.php';
     if (!($img_size = GetImgSize($middleFile))) {
         P_unlink($middleFile);
         return $this->buildResponse(USER_UPLOAD_CONTENT_ERROR);
     }
     list($img_w, $img_h) = getimagesize($middleFile);
     $smallFile = PwUpload::savePath($db_ifftp, $filename, $smallDir);
     $s_ifthumb = 0;
     PwUpload::createFolder(dirname($smallFile));
     if ($ext == 'gif') {
         L::loadClass('gifdecoder', 'utility', false);
         L::loadClass('gif', 'utility', false);
         $gifDecoder = new GIFDecoder($data);
         $frames = $gifDecoder->GIFGetFrames();
         if (!empty($frames)) {
             foreach ($frames as $key => $value) {
                 $frames[$key] = makeAvatarGifThumb($value, $img_w, $img_h, 48, 48);
             }
             $anime = new GIFEncoder($frames, $gifDecoder->GIFGetDelays(), $gifDecoder->GIFGetLoop(), $gifDecoder->GIFGetDisposal(), $gifDecoder->GIFGetTransparentR(), $gifDecoder->GIFGetTransparentG(), $gifDecoder->GIFGetTransparentB(), 'bin');
             $newGifData = $anime->getAnimation();
             PwUpload::createFolder(dirname($smallFile));
             writeover($smallFile, $newGifData);
             $s_ifthumb = 1;
         }
     } elseif (MakeThumb($middleFile, $smallFile, 48, 48)) {
         $s_ifthumb = 1;
     }
     if ($db_ifftp) {
         PwUpload::movetoftp($middleFile, $middleDir . $filename);
         $s_ifthumb && PwUpload::movetoftp($smallFile, $smallDir . $filename);
     }
     $user_a = explode('|', $user->icon);
     $user_a[2] = $img_w;
     $user_a[3] = $img_h;
     $usericon = setIcon("{$udir}/{$user->uid}.{$ext}", 3, $user_a);
     $userService = L::loadClass('UserService', 'user');
     /* @var $userService PW_UserService */
     $userService->update($user->uid, array('icon' => $usericon));
     list($iconurl) = showfacedesign($usericon, 1, 's');
     return $this->buildResponse(0, array('icon' => $iconurl));
 }
示例#23
0
function gameover($time = 0, $gmode = '', $winname = '')
{
    if (eval(__MAGIC__)) {
        return $___RET_VALUE;
    }
    eval(import_module('sys'));
    if ($gamestate < 10) {
        return;
    }
    if (!$gmode || $gmode == 'end2' && !$winname) {
        //在没提供游戏结束模式的情况下,自行判断模式
        if ($validnum <= 0) {
            //无激活者情况下,全部死亡
            $alivenum = 0;
            $winnum = 0;
            $winmode = 4;
            $winner = '';
        } else {
            //判断谁是最后幸存者
            $result = $db->query("SELECT * FROM {$tablepre}players WHERE hp>0 AND type=0");
            $alivenum = $db->num_rows($result);
            if (!$alivenum) {
                //全部死亡
                $winmode = 1;
                $winnum = 0;
                $winner = '';
            } else {
                if (!in_array($gametype, $teamwin_mode)) {
                    //非团队模式,判断最后幸存
                    if ($alivenum == 1) {
                        $winmode = 2;
                        $winnum = 1;
                        $wdata = $db->fetch_array($result);
                        $winner = $wdata['name'];
                        $db->query("UPDATE {$tablepre}players SET state='5' where pid='{$wdata['pid']}'");
                    } else {
                        //不满足游戏结束条件,返回
                        save_gameinfo();
                        return;
                    }
                } else {
                    $result = $db->query("SELECT teamID FROM {$tablepre}players WHERE type = 0 AND hp > 0");
                    $flag = 1;
                    $first = 1;
                    while ($data = $db->fetch_array($result)) {
                        if ($first) {
                            $first = 0;
                            $firstteamID = $data['teamID'];
                        } else {
                            if ($firstteamID != $data['teamID'] || !$data['teamID']) {
                                //如果有超过一种teamID,或有超过一个人没有teamID,则游戏还未就结束
                                $flag = 0;
                                break;
                            }
                        }
                    }
                    if ($flag && !$first) {
                        if (!$firstteamID) {
                            $db->query("UPDATE {$tablepre}players SET state='5' WHERE type = 0 AND hp > 0");
                            $result = $db->query("SELECT name,gd,icon,wep FROM {$tablepre}players WHERE type = 0 AND hp > 0");
                            $zz = $db->fetch_array($result);
                            $winner = $zz['name'];
                            $winnum = 1;
                        } else {
                            $db->query("UPDATE {$tablepre}players SET state='5' WHERE type = 0 AND teamID = '{$firstteamID}'");
                            $result = $db->query("SELECT name FROM {$tablepre}players WHERE type = 0 AND teamID = '{$firstteamID}'");
                            $winnum = $db->num_rows($result);
                            if ($winnum == 1) {
                                $result = $db->query("SELECT name,gd,icon,wep FROM {$tablepre}players WHERE type = 0 AND teamID = '{$firstteamID}'");
                                $zz = $db->fetch_array($result);
                                $winner = $zz['name'];
                            }
                        }
                    } else {
                        //不满足游戏结束条件,返回
                        save_gameinfo();
                        return;
                    }
                    if ($winnum > 1) {
                        $namelist = '';
                        $gdlist = '';
                        $iconlist = '';
                        $weplist = '';
                        while ($data = $db->fetch_array($result)) {
                            $namelist .= $data['name'] . ',';
                        }
                        $winner = substr($namelist, 0, -1);
                    }
                    $winmode = 2;
                }
            }
        }
    } else {
        //提供了游戏结束模式的情况下
        $winmode = substr($gmode, 3, 1);
        $winnum = 1;
        $winner = $winname;
    }
    $time = $time ? $time : $now;
    $result = $db->query("SELECT gid FROM {$wtablepre}winners ORDER BY gid DESC LIMIT 1");
    //判断当前游戏局数是否正确,以优胜列表为准
    if ($db->num_rows($result) && $gamenum <= $db->result($result, 0)) {
        $gamenum = $db->result($result, 0) + 1;
    }
    if ($winmode == 4 || $winmode == 0) {
        //无人参加;不需要记录任何资料
        $getime = $time;
        $db->query("INSERT INTO {$wtablepre}winners (gid,gametype,wmode,vnum,getime) VALUES ('{$gamenum}','{$gametype}','{$winmode}','{$validnum}','{$getime}')");
    } elseif ($winmode == 0 || $winmode == 1 || $winmode == 6) {
        //程序故障、全部死亡、GM中止,不需要记录优胜者资料
        $gstime = $starttime;
        $getime = $time;
        $gtime = $time - $starttime;
        $result = $db->query("SELECT name,killnum FROM {$tablepre}players WHERE type=0 order by killnum desc, lvl desc limit 1");
        $hk = $db->fetch_array($result);
        $hkill = $hk['killnum'];
        $hkp = $hk['name'];
        $db->query("INSERT INTO {$wtablepre}winners (gid,gametype,wmode,vnum,gtime,gstime,getime,hdmg,hdp,hkill,hkp) VALUES ('{$gamenum}','{$gametype}','{$winmode}','{$validnum}','{$gtime}','{$gstime}','{$getime}','{$hdamage}','{$hplayer}','{$hkill}','{$hkp}')");
    } else {
        //最后幸存、锁定解除、核爆全灭,需要记录优胜者资料
        if ($winnum == 1) {
            $result = $db->query("SELECT * FROM {$tablepre}players WHERE name='{$winner}' AND type=0");
            $pdata = $db->fetch_array($result);
            $result2 = $db->query("SELECT motto FROM {$gtablepre}users WHERE username='******'");
            $pdata['motto'] = $db->result($result2, 0);
            $result3 = $db->query("SELECT name,killnum FROM {$tablepre}players WHERE type=0 order by killnum desc, lvl desc limit 1");
            $hk = $db->fetch_array($result3);
            $pdata['hkill'] = $hk['killnum'];
            $pdata['hkp'] = $hk['name'];
            $pdata['wmode'] = $winmode;
            $pdata['vnum'] = $validnum;
            $pdata['gtime'] = $time - $starttime;
            $pdata['gstime'] = $starttime;
            $pdata['getime'] = $time;
            $pdata['hdmg'] = $hdamage;
            $pdata['hdp'] = $hplayer;
            $db->query("INSERT INTO {$wtablepre}winners (gid,gametype,name,pass,type,endtime,gd,sNo,icon,club,hp,mhp,sp,msp,att,def,pls,lvl,`exp`,money,bid,inf,rage,pose,tactic,killnum,state,wp,wk,wg,wc,wd,wf,teamID,teamPass,wep,wepk,wepe,weps,arb,arbk,arbe,arbs,arh,arhk,arhe,arhs,ara,arak,arae,aras,arf,arfk,arfe,arfs,art,artk,arte,arts,itm0,itmk0,itme0,itms0,itm1,itmk1,itme1,itms1,itm2,itmk2,itme2,itms2,itm3,itmk3,itme3,itms3,itm4,itmk4,itme4,itms4,itm5,itmk5,itme5,itms5,itm6,itmk6,itme6,itms6,motto,wmode,vnum,gtime,gstime,getime,hdmg,hdp,hkill,hkp,wepsk,arbsk,arhsk,arask,arfsk,artsk,itmsk0,itmsk1,itmsk2,itmsk3,itmsk4,itmsk5,itmsk6,cardname) VALUES ('" . $gamenum . "','" . $gametype . "','" . $pdata['name'] . "','" . $pdata['pass'] . "','" . $pdata['type'] . "','" . $pdata['endtime'] . "','" . $pdata['gd'] . "','" . $pdata['sNo'] . "','" . $pdata['icon'] . "','" . $pdata['club'] . "','" . $pdata['hp'] . "','" . $pdata['mhp'] . "','" . $pdata['sp'] . "','" . $pdata['msp'] . "','" . $pdata['att'] . "','" . $pdata['def'] . "','" . $pdata['pls'] . "','" . $pdata['lvl'] . "','" . $pdata['exp'] . "','" . $pdata['money'] . "','" . $pdata['bid'] . "','" . $pdata['inf'] . "','" . $pdata['rage'] . "','" . $pdata['pose'] . "','" . $pdata['tactic'] . "','" . $pdata['killnum'] . "','" . $pdata['state'] . "','" . $pdata['wp'] . "','" . $pdata['wk'] . "','" . $pdata['wg'] . "','" . $pdata['wc'] . "','" . $pdata['wd'] . "','" . $pdata['wf'] . "','" . $pdata['teamID'] . "','" . $pdata['teamPass'] . "','" . $pdata['wep'] . "','" . $pdata['wepk'] . "','" . $pdata['wepe'] . "','" . $pdata['weps'] . "','" . $pdata['arb'] . "','" . $pdata['arbk'] . "','" . $pdata['arbe'] . "','" . $pdata['arbs'] . "','" . $pdata['arh'] . "','" . $pdata['arhk'] . "','" . $pdata['arhe'] . "','" . $pdata['arhs'] . "','" . $pdata['ara'] . "','" . $pdata['arak'] . "','" . $pdata['arae'] . "','" . $pdata['aras'] . "','" . $pdata['arf'] . "','" . $pdata['arfk'] . "','" . $pdata['arfe'] . "','" . $pdata['arfs'] . "','" . $pdata['art'] . "','" . $pdata['artk'] . "','" . $pdata['arte'] . "','" . $pdata['arts'] . "','" . $pdata['itm0'] . "','" . $pdata['itmk0'] . "','" . $pdata['itme0'] . "','" . $pdata['itms0'] . "','" . $pdata['itm1'] . "','" . $pdata['itmk1'] . "','" . $pdata['itme1'] . "','" . $pdata['itms1'] . "','" . $pdata['itm2'] . "','" . $pdata['itmk2'] . "','" . $pdata['itme2'] . "','" . $pdata['itms2'] . "','" . $pdata['itm3'] . "','" . $pdata['itmk3'] . "','" . $pdata['itme3'] . "','" . $pdata['itms3'] . "','" . $pdata['itm4'] . "','" . $pdata['itmk4'] . "','" . $pdata['itme4'] . "','" . $pdata['itms4'] . "','" . $pdata['itm5'] . "','" . $pdata['itmk5'] . "','" . $pdata['itme5'] . "','" . $pdata['itms5'] . "','" . $pdata['itm6'] . "','" . $pdata['itmk6'] . "','" . $pdata['itme6'] . "','" . $pdata['itms6'] . "','" . $pdata['motto'] . "','" . $pdata['wmode'] . "','" . $pdata['vnum'] . "','" . $pdata['gtime'] . "','" . $pdata['gstime'] . "','" . $pdata['getime'] . "','" . $pdata['hdmg'] . "','" . $pdata['hdp'] . "','" . $pdata['hkill'] . "','" . $pdata['hkp'] . "','" . $pdata['wepsk'] . "','" . $pdata['arbsk'] . "','" . $pdata['arhsk'] . "','" . $pdata['arask'] . "','" . $pdata['arfsk'] . "','" . $pdata['artsk'] . "','" . $pdata['itmsk0'] . "','" . $pdata['itmsk1'] . "','" . $pdata['itmsk2'] . "','" . $pdata['itmsk3'] . "','" . $pdata['itmsk4'] . "','" . $pdata['itmsk5'] . "','" . $pdata['itmsk6'] . "','" . $pdata['cardname'] . "')");
        } else {
            $gstime = $starttime;
            $getime = $time;
            $gtime = $time - $starttime;
            $result = $db->query("SELECT name,killnum FROM {$tablepre}players WHERE type=0 order by killnum desc, lvl desc limit 1");
            $hk = $db->fetch_array($result);
            $hkill = $hk['killnum'];
            $hkp = $hk['name'];
            $db->query("INSERT INTO {$wtablepre}winners (gid,gametype,wmode,vnum,gtime,gstime,getime,hdmg,hdp,hkill,hkp,winnum,namelist,teamID) VALUES ('{$gamenum}','{$gametype}','{$winmode}','{$validnum}','{$gtime}','{$gstime}','{$getime}','{$hdamage}','{$hplayer}','{$hkill}','{$hkp}','{$winnum}','{$namelist}','{$firstteamID}')");
        }
    }
    post_gameover_events();
    rs_sttime();
    //重置游戏开始时间和当前游戏状态
    $gamestate = 0;
    save_gameinfo();
    //echo '**游戏结束**';
    //$gamestate = 0;
    //addnews($time, "end$winmode" , $winner);
    addnews($time, "end{$winmode}", $winner);
    //addnews($time, 'gameover',$gamenum);
    addnews($time, 'gameover', $gamenum);
    systemputchat($time, 'gameover');
    $newsinfo = nparse_news(0, 65535);
    $room_gprefix = '';
    if ($room_prefix != '') {
        $room_gprefix = substr($room_prefix, 0, 1) . '.';
    }
    writeover(GAME_ROOT . "./gamedata/bak/{$room_gprefix}{$gamenum}_newsinfo.html", $newsinfo, 'wb+');
    set_credits();
    return;
}
示例#24
0
                    writeover($objfile, parse_codeadv3($data));
                    echo '完成。<br>';
                    ob_end_flush();
                    flush();
                }
            }
        }
    }
    echo '<font color="blue">代码预处理CODE_ADV3完成。</font><br><br>';
    $str = '___temp_s = new String(\'' . base64_encode(gzencode(compatible_json_encode($___TEMP_codeadv3_v))) . '\');
	___datalib = JSON.parse(JXG.decompress(___temp_s));
	delete ___temp_s;
	';
    $file = 'datalib.' . uniqid('', true) . '.js';
    writeover(GAME_ROOT . './gamedata/javascript/' . $file, $str);
    writeover(GAME_ROOT . './gamedata/javascript/datalib.current.txt', $file);
}
$faillog = '';
copy(GAME_ROOT . './gamedata/modules.list.pass.php', GAME_ROOT . './gamedata/modules.list.php');
unlink(GAME_ROOT . './gamedata/modules.list.pass.php');
unlink(GAME_ROOT . './gamedata/modules.list.temp.php');
if ($___MOD_SRV) {
    //重启daemon
    echo '<font color="blue">正在重启Daemon...</font> ';
    ob_end_flush();
    flush();
    require GAME_ROOT . './include/socket.func.php';
    __STOP_ALL_SERVER__();
    touch(GAME_ROOT . './gamedata/tmp/server/request_new_root_server');
    __SOCKET_LOG__("已请求脚本启动一台新的服务器。");
    echo '<font color="blue">完成。</font><br><br>';
示例#25
0
         $selid = pwImplode($alltids);
     } else {
         adminmsg('operate_error', "{$basename}&action=postcate");
     }
     $uids = '';
     $query = $db->query("SELECT authorid FROM pw_threads WHERE tid IN({$selid}) GROUP BY authorid");
     while ($rt = $db->fetch_array($query)) {
         $uids .= $uids ? ',' . $rt['authorid'] : $rt['authorid'];
     }
     include PrintEot('postcate');
     exit;
 } elseif ($step == '2') {
     InitGP(array('subject', 'atc_content', 'uids'));
     $cache_file = D_P . "data/bbscache/" . substr(md5($admin_pwd), 10, 10) . ".txt";
     if (!$nexto) {
         writeover($cache_file, $atc_content);
     } else {
         $atc_content = readover($cache_file);
     }
     if (empty($subject) || empty($atc_content)) {
         adminmsg('sendmsg_empty', 'javascript:history.go(-1);');
     }
     $subject = Char_cv($subject);
     $sendmessage = Char_cv($atc_content);
     $percount = 1;
     empty($nexto) && ($nexto = 1);
     $uids = explode(',', $uids);
     $count = count($uids);
     if ($uids) {
         $uids = pwImplode($uids);
         $msg_a = array();
示例#26
0
    Iplimit();
    $temp_a = array_merge($_POST, $_GET);
    foreach ($temp_a as $key => $value) {
        if ($key != 'module') {
            CheckVar($value);
        }
    }
    unset($temp_a);
    $admin_level = $ltitle[$admin_gid];
} else {
    $admin_level = getLangInfo('other', 'admin_level');
    //'manager';
}
$_postdata = $_POST ? PostLog($_POST) : '';
$new_record = '|' . str_replace('|', '&#124;', Char_cv($admin_name)) . '||' . str_replace('|', '&#124;', Char_cv($REQUEST_URI)) . "|{$onlineip}|{$timestamp}|{$_postdata}|\n";
writeover($bbsrecordfile, $new_record, "ab");
if ($pwServer['REQUEST_METHOD'] == 'POST') {
    $referer_a = @parse_url($pwServer['HTTP_REFERER']);
    if ($referer_a['host']) {
        list($http_host) = explode(':', $pwServer['HTTP_HOST']);
        if ($referer_a['host'] != $http_host) {
            adminmsg('undefined_action');
        }
    }
    unset($referer_a);
    PostCheck($verify);
}
unset($_postdata, $new_record, $bbsrecordfile, $dbhost, $dbuser, $dbpw, $dbname, $pconnect, $newmanager, $newmngpwd);
function HtmlConvert(&$array)
{
    if (is_array($array)) {
示例#27
0
        $s = $subjectid ? $subjectid . '_' . $page . '.xml' : '300.xml';
    } elseif ($type == 'magic') {
        $s = $subjectid ? $subjectid . '_' . $page . '.xml' : '200.xml';
    }
    $cachefile = D_P . "data/bbscache/myshow_{$s}";
    if (!file_exists($cachefile) || $timestamp - pwFilemtime($cachefile) > 43200) {
        $data = '';
        if ($subjectid) {
            $url = "{$u}/list/{$s}?{$timestamp}";
        } else {
            $url = "{$u}/menu/{$s}?{$timestamp}";
        }
        require_once R_P . 'require/posthost.php';
        $data = PostHost($url);
        if ($data && strpos($data, '<?xml') !== false) {
            writeover($cachefile, $data);
        }
    }
    header("Content-Type: text/xml; charset=UTF-8");
    $data = readover($cachefile);
    echo $data;
    exit;
} elseif ($action == 'honor') {
    !$_G['allowhonor'] && Showmsg('undefined_action');
    if (empty($_POST['step'])) {
        require_once PrintEot('ajax');
        ajax_footer();
    } else {
        PostCheck();
        InitGP(array('content'), 'P');
        $content = str_replace("\n", '', $content);
示例#28
0
function WriteLog($msg)
{
    global $setting;
    if ($setting['nolog']) {
        return;
    }
    writeover(ONEZ_ROOT . './onezdata/senderr.txt', "\n" . $msg, 'a+');
}
示例#29
0
            $pre = 'pw_' . get_date($timestamp, 'md') . '_' . randstr(10) . '_';
            $bakuptable = bakuptable($tabledb);
        }
        $f_num = ceil($step / 2);
        $filename = $pre . $f_num . '.sql';
        $step++;
        $writedata = $bakuptable ? $bakuptable . $bakupdata : $bakupdata;
        $t_name = $tabledb[$tableid - 1];
        $c_n = $start;
        if ($stop == 1) {
            $files = $step - 1;
            trim($writedata) && writeover(D_P . 'data/' . $filename, $bak . $writedata, 'ab');
            $j_url = "{$basename}&action={$action}&start={$start}&tableid={$tableid}&sizelimit={$sizelimit}&step={$step}&pre={$pre}&tablesel={$tablesel}&rows={$rows}";
            adminmsg('bakup_step', EncodeUrl($j_url), 2);
        } else {
            trim($writedata) && writeover(D_P . 'data/' . $filename, $bak . $writedata, 'ab');
            if ($step > 1) {
                for ($i = 1; $i <= $f_num; $i++) {
                    $bakfile .= '<a href="data/' . $pre . $i . '.sql">' . $pre . $i . '.sql</a><br>';
                }
            }
            adminmsg('bakup_out');
        }
    }
} elseif ($admintype == 'bakin') {
    if (empty($action)) {
        $filedb = array();
        $handle = opendir(D_P . 'data');
        while ($file = readdir($handle)) {
            if ((!$PW || eregi("^pw_", $file) || eregi("^{$PW}", $file)) && eregi("\\.sql\$", $file)) {
                $strlen = eregi("^{$PW}", $file) ? 16 + strlen($PW) : 19;
示例#30
0
    preg_match_all($pat4, $array4[0][0], $array5);
    $body = "";
    for ($i = 0; $i < sizeof($array5[1]); $i++) {
        $body .= $array5[1][$i] . " ";
    }
    $array2[1][0] = $array2[1][0] ? $array2[1][0] : $array9[1][0];
    $array3[1][0] = $array3[1][0] ? $array3[1][0] : $array8[1][0];
    $results = "<br/><b>Title: </b>" . $array[1][0] . "<br/><b>KeyWords: </b>" . $array2[1][0] . "<br/><b>Description: </b>" . $array3[1][0] . "<br/><b>Body: </b>" . $body;
    @(require_once 'cache.php');
    if (file_exists("cache/eseach.php")) {
        @(require_once "cache/eseach.php");
        $urls = filehave($urls, $domain);
    } else {
        $urls = fileno($domain);
    }
    writeover("cache/eseach.php", "<?php\r\n\$urls=" . vvar_export($urls) . ";\r\n?>");
}
@(require_once 'header.php');
?>
<div class="main">
          <div class="box">
            <div id="c">
              <h1>搜索蜘蛛、机器人模拟工具</h1>
              <div class="box1" style="text-align:left;"> 
			  <form action="" method="post">
                  <span class="info3" > 请输入要查询的域名:
                   <font color="green"><b>HTTP://</b></font> <input name="domain" type="text" id="domain" class="input" size="40" url="true" value="<?php 
echo $domain;
?>
"/>
                    <input name="btnS" class="but" type="submit" value="查询"  id="sub"/>