コミットを比較

...

2 コミット

作成者 SHA1 メッセージ 日付
守矢諏訪子 e22731c8ce クッキーの例え 2022-03-30 20:14:51 +09:00
守矢諏訪子 54214f2fdd ホームはたとえ一覧ページ化 2022-03-30 20:14:06 +09:00
5個のファイルの変更42行の追加3行の削除

ファイルの表示

@ -1,9 +1,9 @@
<?php
function getcookie (string $name): array {
function getcookie (string $name): string {
return htmlspecialchars($_COOKIE[$name]);
}
function getrawcookie (string $name): array {
function getrawcookie (string $name): string {
return $_COOKIE[$name];
}
?>

ファイルの表示

@ -7,3 +7,7 @@ body {
background-color: var(--mainBackgroundColor);
font-size: 14px;
}
a {
color: #ffeb3b;
}

15
src/cookie/index.php ノーマルファイル
ファイルの表示

@ -0,0 +1,15 @@
<?php
if (isset($_POST['lolicon_cookie'])) {
// 2時間後消えられます。
setcookie('lolicon_cookie', $_POST['lolicon_cookie'], ['expires' => time()+60*60*2, 'path' => '/cookie', 'httponly' => true]);
//setrawcookie('lolicon_cookie', $_POST['lolicon_cookie'], ['expires' => time()+60*60*2, 'path' => '/cookie', 'httponly' => true]);
header('Location: /cookie', 301);
}
$title = 'クッキー'; // 必須・Requirement
$sitedesc = 'クッキーの例え'; // config.phpの文字の交換・Change character of config.php
$siteurl .= '/cookie'; // config.phpの文字に追加・Add to character of config.php
$childview = '../ui/cookie/index.php'; // 必須・Requirement
$mycookie = getcookie('lolicon_cookie');
//$mycookie = getrawcookie('lolicon_cookie');
?>

9
ui/cookie/index.php ノーマルファイル
ファイルの表示

@ -0,0 +1,9 @@
setcookie
<form method="POST" action="/cookie">
<input type="text" name="lolicon_cookie" />
<input type="submit" value="送信" />
</form>
<hr />
getcookie
<?php echo $mycookie; ?>

ファイルの表示

@ -1,3 +1,14 @@
<section>
例のページ
<h1>例の一覧</h1>
<ul>
<?php
$scan = array_diff(scandir('../ui'), ['..', '.']);
foreach ($scan as $s) {
?>
<li><a href="/<?php echo $s; ?>"><?php echo $s; ?></a></li>
<?php
}
?>
</ul>
</section>