示例#1
0
<?php

require_once __DIR__ . '/src/core.php';
$dir = RoomSavepath;
$roomlist = [];
foreach (Onset::getRoomlist() as $room => $data) {
    if (time() - filemtime($dir . $data->path) > RoomDelTime) {
        continue;
    }
    $roomlist[$room] = $data;
}
session_start();
$_SESSION['onset_rand'] = $rand = mt_rand();
$welcomeMessage = file_get_contents('welcomeMessage.html');
?>

<!DOCTYPE html>
<html lang="ja">
<head>
    <meta charset="UTF-8">
    <title>Onset!</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache">
    
    <script src="js/jquery.js"></script>
    <script src="js/script.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script>rand = <?php 
echo $rand;
?>
示例#2
0
<?php

require_once __DIR__ . '/core.php';
$roomlist = Onset::getRoomlist();
$i = 0;
foreach ($roomlist as $room => $data) {
    $dir = RoomSavepath . $data->path . "/";
    $leftTime = filemtime($dir);
    if (time() - $leftTime > RoomDelTime) {
        try {
            Onset::removeRoomData($dir);
            unset($roomlist->{$room});
            if (!Onset::saveRoomlist($roomlist)) {
                throw new Exception("部屋インデックスデータの保存に失敗しました");
            }
        } catch (Exception $e) {
            echo Onset::jsonMessage($e->getMessage(), -1);
            die;
        }
        $i += 1;
    }
}
echo $i > 0 ? Onset::jsonMessage($i . '部屋削除しました') : Onset::jsonMessage('ok');