function passCheck() { global $init; if (file_exists("{$init->passwordFile}")) { $fp = fopen("{$init->passwordFile}", "r"); $masterPassword = chop(fgets($fp, READ_LINE)); fclose($fp); } if (!isset($this->dataSet['PASSWORD'])) { HakoError::wrongPassword(); return 0; } if (strcmp(crypt($this->dataSet['PASSWORD'], 'ma'), $masterPassword) == 0) { return 1; } else { HakoError::wrongPassword(); return 0; } }
function allyPactMain($hako, $data) { $ally = $hako->ally[$hako->idToAllyNumber[$data['ALLYID']]]; if (AllyUtil::checkPassword($ally['password'], $data['Allypact'])) { $ally['comment'] = AllyUtil::htmlEscape($data['ALLYCOMMENT']); $ally['title'] = AllyUtil::htmlEscape($data['ALLYTITLE']); $ally['message'] = AllyUtil::htmlEscape($data['ALLYMESSAGE'], 1); $hako->ally[$hako->idToAllyNumber[$data['ALLYID']]] = $ally; // データ書き出し $hako->writeAllyFile(); // 変更成功 Success::allyPactOK($ally['name']); } else { // password間違い HakoError::wrongPassword(); return; } }
function register($hako, $data) { global $init; // パスワード if (!Util::checkPassword("", $data['PASSWORD'])) { // password間違い HakoError::wrongPassword(); return; } $id = $data['ISLANDID']; $number = $hako->idToNumber[$id]; $island = $hako->islands[$number]; $land =& $island['land']; $landValue =& $island['landValue']; $x = $data['POINTX']; $y = $data['POINTY']; $ld = $data['LAND']; $mons = $data['MONSTER']; $ships = $data['SHIP']; $level = $data['LEVEL']; if ($ld == $init->landMonster || $ld == $init->landSleeper) { // 怪獣のレベル設定 $BHP = $init->monsterBHP[$mons]; if ($init->monsterDHP[$mons] > 0) { $DHP = Util::random($init->monsterDHP[$mons] - 1); } else { $DHP = Util::random($init->monsterDHP[$mons]); } $level = $BHP + $DHP; $level = $mons * 100 + $level; } elseif ($ld == $init->landShip) { // 船舶のレベル設定 $level = Util::navyPack($id, $ships, $init->shipHP[$ships], 0, 0); } // 更新データ設定 $land[$x][$y] = $ld; $landValue[$x][$y] = $level; // マップデータ更新 $hako->writeLand($id, $island); // 設定した値を戻す $hako->islands[$number] = $island; Util::makeTagMessage("地形を変更しました", "success"); // マップエディタの表示へ $this->editMap($hako, $data); }
function owner($hako, $data) { global $init; $this_file = $init->baseDir . "/hako-main.php"; $id = $data['ISLANDID']; $number = $hako->idToNumber[$id]; $island = $hako->islands[$number]; // パスワードチェック if (!Util::checkPassword($island['password'], $data['PASSWORD'])) { HakoError::wrongPassword(); return; } // 開発画面 $this->tempOwer($hako, $data, $number); // IP情報取得 $logfile = "{$init->dirName}/{$init->logname}"; $ax = $init->axesmax - 1; $log = file($logfile); $fp = fopen($logfile, "w"); $timedata = date("Y年m月d日(D) H時i分s秒"); $islandID = "{$data['ISLANDID']}"; $name = "{$island['name']}{$init->nameSuffix}"; $ip = getenv("REMOTE_ADDR"); $host = gethostbyaddr(getenv("REMOTE_ADDR")); fputs($fp, $timedata . "," . $islandID . "," . $name . "," . $ip . "," . $host . "\n"); for ($i = 0; $i < $ax; $i++) { if (isset($log[$i])) { fputs($fp, $log[$i]); } } fclose($fp); $this->islandRecent($island, 1); }
function commandMain($hako, $data) { global $init; $id = $data['ISLANDID']; $num = $hako->idToNumber[$id]; $island = $hako->islands[$num]; $name = $island['name']; // パスワード if (!Util::checkPassword($island['password'], $data['PASSWORD'])) { // password間違い HakoError::wrongPassword(); return; } // モードで分岐 $command = $island['command']; $comary = explode(" ", $data['COMARY']); for ($i = 0; $i < $init->commandMax; $i++) { $pos = $i * 5; $kind = $comary[$pos]; $x = $comary[$pos + 1]; $y = $comary[$pos + 2]; $arg = $comary[$pos + 3]; $target = $comary[$pos + 4]; // コマンド登録 if ($kind == 0) { $kind = $init->comDoNothing; } $command[$i] = array('kind' => $kind, 'x' => $x, 'y' => $y, 'arg' => $arg, 'target' => $target); } Success::commandAdd(); // データの書き出し $island['command'] = $command; $hako->islands[$num] = $island; $hako->writeIslandsFile($island['id']); // owner modeへ $html = new HtmlMapJS(); $html->owner($hako, $data); }