if (substr($item, 0, 7) == 'invite_') { $inviteCode = substr($item, 7, -5); $inviteObj = json_decode(getFileContent($srkEnv->userPath . '/' . $item)); $inviteObj->value = $inviteCode; array_push($res, $inviteObj); } } srkSend((object) array('list' => $res)); } elseif ($srkEnv->reqURLLength == 4 && $srkEnv->reqURL[3] == 'generate') { $count = (int) $srkEnv->reqURL[4]; $defInfo = (object) array('used' => false); if ($count > 0 && $count < 16) { for ($i = 0; $i < $count; ++$i) { $code = ''; do { $code = randId(16); } while (is_file($srkEnv->userPath . '/invite_' . $code . '.json')); $codeFileName = $srkEnv->userPath . '/invite_' . $code . '.json'; takeDownJSON($codeFileName, $defInfo); } } srkSend((object) array('res' => 'Done')); } } elseif ($srkEnv->reqURL[2] == 'file') { if (!in_array('file', $user->getField("accessList"))) { srkSend((object) array('error' => 'Access denied')); } elseif ($srkEnv->reqURLLength == 3 && $srkEnv->reqURL[3] == 'upload') { $fileName = $_POST['fileName']; $fileContent = uploadFileContentDecipher(); if ($fileName && $fileContent) { $writeRes = takeDownString($fileName, $fileContent);
</head> <body> <div class = "center"> <div> <h2>Load Game</h1> <form action = "lobby.php"> <span> <div> Game ID: <input type="text" name="gameid" /> </div> <div> Name: <input type="text" name="name" /> </div> <input type="hidden" name="uuid" value="<?php echo randId(16); ?> "> </span> <br /> <input class="button "type="submit" value="Join Game" /> </form> </span> </div> </body> </html>
function commentPost($user) { global $srkEnv; if (strlen($_POST['content']) > 140) { return 'Too long'; } elseif (!is_string($_POST['content']) || strlen($_POST['content']) < 2) { return 'Invalid comment'; } $penCommentPath = $srkEnv->penPath . '/' . $_POST['penId'] . '/comment'; if (!is_dir($penCommentPath)) { mkdir($penCommentPath); } $commentId = ''; do { $commentId = randId(8); } while (is_dir($penCommentPath . '/' . $commentId)); $commentPath = $penCommentPath . '/' . $commentId; mkdir($commentPath); takeDownString($commentPath . '/content.html', $_POST['content']); $config = (object) array('commentId' => $commentId, 'owner' => $user->getField('userId'), 'modifyTime' => time()); takeDownJSON($commentPath . '/config.json', $config); commentListGenerate(); return false; }