01.
<?php
02.
session_cache_limiter(
'nocache'
);
03.
session_start();
04.
?>
05.
<!DOCTYPE html>
06.
<html>
07.
<head>
08.
<meta content=
"width=device-width initial-scale=1.0 minimum-scale=1.0 maximum-scale=1.0 user-scalable=no"
name=
"viewport"
>
09.
<meta charset=
"UTF-8"
>
10.
<link rel=
"stylesheet"
href=
"https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/css/bootstrap.css"
>
11.
</head>
12.
<body>
13.
14.
<form>
15.
学籍番号 <input type=
"text"
name=
"r101"
>
16.
<input type=
"submit"
name=
"send"
value=
"送信"
>
17.
</form>
18.
19.
<pre>
20.
<?php
21.
22.
23.
$text
= write_log();
24.
25.
26.
print
$text
;
27.
28.
?>
29.
</pre>
30.
31.
</body>
32.
</html>
33.
<?php
34.
35.
36.
37.
38.
function
write_log() {
39.
40.
$target
=
"log/data_"
. session_id() .
".txt"
;
41.
42.
if
(
file_exists
(
$target
) ) {
43.
$text
= @
file_get_contents
(
$target
);
44.
}
45.
else
{
46.
$text
=
""
;
47.
}
48.
49.
50.
if
(
$_GET
[
"send"
] !=
""
) {
51.
52.
$text
=
$_GET
[
"r101"
] .
"\r\n"
.
$text
;
53.
54.
55.
file_put_contents
(
$target
,
$text
);
56.
}
57.
58.
return
$text
;
59.
60.
}
61.
62.
?>