main
Pk11 3 years ago
parent 7d799f7735
commit 8195ba2076

@ -15,7 +15,7 @@
</header> </header>
<main> <main>
<h2>Subdomains</h2> <h2 id="subdomain">Subdomains</h2>
<dl> <dl>
<dt><a href="//bad-apple.xn--rck9c.xn--tckwe/index.html">bad-apple</a></dt> <dt><a href="//bad-apple.xn--rck9c.xn--tckwe/index.html">bad-apple</a></dt>
<dd>Bad Apple!! but it's pure HTML (no JS or CSS)</dd> <dd>Bad Apple!! but it's pure HTML (no JS or CSS)</dd>
@ -45,7 +45,7 @@
<dd>Home</dd> <dd>Home</dd>
</dl> </dl>
<h2>Other Pages</h2> <h2 id="page">Other Pages</h2>
<dl> <dl>
<dt><a href="/agent.php">agent.php</a></dt> <dt><a href="/agent.php">agent.php</a></dt>
<dd>Shows the useragent</dd> <dd>Shows the useragent</dd>
@ -59,6 +59,9 @@
<dt><a href="/dQw4w9WgXcQ/index.html">dQw4w9WgXcQ</a></dt> <dt><a href="/dQw4w9WgXcQ/index.html">dQw4w9WgXcQ</a></dt>
<dd aria-label="Winking face">;)</dd> <dd aria-label="Winking face">;)</dd>
<dt><a href="/motd.php">motd.php</a></dt>
<dd>A random message each day</dd>
<dt><a href="/video.php">video.php</a></dt> <dt><a href="/video.php">video.php</a></dt>
<dd>Makes videos show in embeds</dd> <dd>Makes videos show in embeds</dd>
</dl> </dl>

@ -15,7 +15,7 @@
</header> </header>
<main> <main>
<h2>サブドメイン</h2> <h2 id="subdomain">サブドメイン</h2>
<dl> <dl>
<dt><a href="//bad-apple.xn--rck9c.xn--tckwe/ja.html">bad-apple</a></dt> <dt><a href="//bad-apple.xn--rck9c.xn--tckwe/ja.html">bad-apple</a></dt>
<dd>Bad Apple!!でも、HTMLだけです(JSやCSSなし)</dd> <dd>Bad Apple!!でも、HTMLだけです(JSやCSSなし)</dd>
@ -45,7 +45,7 @@
<dd></dd> <dd></dd>
</dl> </dl>
<h2>他のページ</h2> <h2 id="page">他のページ</h2>
<dl> <dl>
<dt><a href="/agent.php">agent.php</a></dt> <dt><a href="/agent.php">agent.php</a></dt>
<dd>ユーザーエイジェントを表示</dd> <dd>ユーザーエイジェントを表示</dd>
@ -55,10 +55,13 @@
<dt><a href="/color.html">color.html</a></dt> <dt><a href="/color.html">color.html</a></dt>
<dd>16進、RGB、BGR15の間で色を変換</dd> <dd>16進、RGB、BGR15の間で色を変換</dd>
<dt><a href="/dQw4w9WgXcQ/index.html">dQw4w9WgXcQ</a></dt> <dt><a href="/dQw4w9WgXcQ/index.html">dQw4w9WgXcQ</a></dt>
<dd aria-label="ウィンク顔">;)</dd> <dd aria-label="ウィンク顔">;)</dd>
<dt><a href="/motd.php">motd.php</a></dt>
<dd>毎日でランダムなメッセージ</dd>
<dt><a href="/video.php">video.php</a>(英語)</dt> <dt><a href="/video.php">video.php</a>(英語)</dt>
<dd>埋め込みにビデオを表示</dd> <dd>埋め込みにビデオを表示</dd>
</dl> </dl>

@ -0,0 +1,79 @@
<?php
$today = floor(date('U') / 24 / 60 / 60) * 24 * 60 * 60;
srand($today);
function motd($wordsPath) {
$out = [];
$words = explode("\n", file_get_contents($wordsPath));
$count = rand(1, 10);
for($i = 0; $i < $count; $i++) {
$word = $words[array_rand($words)];
if(rand(0, 4) == 0) { // 1 in 5 chance
$puctuation = [",", ".", ":", ";", "...", "!", "?"];
$word .= $puctuation[array_rand($puctuation)];
}
$out[] = $word;
}
return implode(" ", $out);
}
// Return source code
if(isset($_GET['source'])) {
header("Content-Type: text/plain");
die(file_get_contents(basename($_SERVER['PHP_SELF'])));
}
// Plaintext
if(isset($_GET['raw'])) {
header("Content-Type: text/plain");
die(motd("../words.txt"));
}
$motd = motd("../words.txt");
if(isset($_GET['rss'])) {
header("Content-Type: application/rss+xml");
?>
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>MOTD | ピケ.コム</title>
<link>http://xn--rck9c.xn--tckwe/motd.php</link>
<atom:link href="http://bbs.xn--rck9c.xn--tckwe/rss.php" rel="self" type="application/rss+xml" />
<description>A random message each day</description>
<lastBuildDate><?php echo date('r', $today); ?></lastBuildDate>
<language>en-US</language>
<item>
<title><?php echo $motd; ?></title>
<link>http://xn--rck9c.xn--tckwe/motd.php</link>
<description><?php echo $motd; ?></description>
<author>Pk11</author>
<pubDate><?php echo $post['pubDate']; ?></pubDate>
<guid isPermaLink="false"><?php echo $today; ?></guid>
</item>
</channel>
</rss>
<?php } else { ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php echo htmlspecialchars($motd); ?></title>
<meta name="description" content="<?php echo $motd; ?>">
<link rel="alternate" type="application/rss+xml" title="RSS feed" href="?rss" />
</head>
<body>
<h1 title="<?php echo date("Y-m-d (T)"); ?>"><?php echo htmlspecialchars($motd); ?></h1>
<p>
[<a href="//xn--rck9c.xn--tckwe/">back</a>]
[<a href="?raw">raw</a>]
[<a href="?rss">rss</a>]
[<a href="?source">source</a>]
</p>
</body>
</html>
<?php } ?>
Loading…
Cancel
Save