質問編集履歴

1

コードの削除

2018/02/15 10:11

投稿

tidavest
tidavest

スコア595

test CHANGED
File without changes
test CHANGED
@@ -1,337 +1,3 @@
1
- ```
2
-
3
- <?php
4
-
5
-
6
-
7
- $dataFile = 'bbs.dat';
8
-
9
-
10
-
11
- session_start();
12
-
13
-
14
-
15
- function setToken() {
16
-
17
- $token = sha1(sharagames(mt_rand(),true));
18
-
19
- $_SESSION['token'] = $token;
20
-
21
- }
22
-
23
-
24
-
25
- function checkToken() {
26
-
27
- if (empty($_SESSION['token']) || ($_SESSION['token'} != $_POST['token'])) {
28
-
29
- echo "不正な処理が行われました";
30
-
31
- exit;
32
-
33
- }
34
-
35
-
36
-
37
- function h($s) {
38
-
39
- return htmlspecialchars($s, ENT_QUOTES, 'UTF-8');
40
-
41
- }
42
-
43
-
44
-
45
- if ($_SERVER['REQUEST_METHOD'] = 'POST') {
46
-
47
- //isset($_POST['message'] &&
48
-
49
- //isset($_POST['user'])) {
50
-
51
- $message = $_POST['message'];
52
-
53
- $user = $_POST['user'];
54
-
55
- }
56
-
57
- if ($message != '') {
58
-
59
- $user = ($user == '') ? 'ななしさん' : $user;
60
-
61
- $postedAt = date('Y-m-d H:i:s');
62
-
63
- // $postedAt = date('Y-m-d H:i:s');
64
-
65
- $message = str_replace( "\t",' ',$message);
66
-
67
- $user = str_replace( "\t",' ',$user);
68
-
69
-
70
-
71
- $newData = $message . "\t" . $user . "\t" . $postedAt. "\n";
72
-
73
- $fp = fopen($dataFile, 'a');
74
-
75
- fwrite($fp, $newData);
76
-
77
- fclose($fp);
78
-
79
- }
80
-
81
-
82
-
83
-
84
-
85
- $posts = file($dataFile, FILE_IGNORE_NEW_LINES);
86
-
87
- $posts = array_reverse($posts);
88
-
89
- ?>
90
-
91
-
92
-
93
- <!DOCTYPE html>
94
-
95
- <html lang="ja">
96
-
97
- <head>
98
-
99
- <meta charset="utf-8">
100
-
101
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
102
-
103
- <meta name="viewport" content="width=device-width, initial-scale=1">
104
-
105
- <title>uber driverになってフレキシブルに働こう</title>
106
-
107
- <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
108
-
109
- <link rel="stylesheet" type="text/css" href=".css">
110
-
111
- <script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
112
-
113
- <html xmlns="http://www.w3.org/1999/xhtml">
114
-
115
- <!--[if lt IE 9]>
116
-
117
- <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
118
-
119
- <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
120
-
121
- <![endif]-->
122
-
123
- </head>
124
-
125
- <body>
126
-
127
- <div class="border"><span class="charastric"><marquee scrolldelay="100">文章</marquee></span></div>
128
-
129
- <i class="fas fa-motorcycle fa-2x"></i> <HR class="hr">
130
-
131
- <div class="container-fluid">
132
-
133
- <div class="row">
134
-
135
- <div class="col-sm-8">
136
-
137
- <p class="margin">文章</p>
138
-
139
- <div class="center">
140
-
141
- <img style="width:700px;height:300px;margin:15px 40px 15px 40px"src="uber.jpg">
142
-
143
- </div>
144
-
145
- <div class="section">
146
-
147
- <h2 id=whatauber>文章</h2>
148
-
149
- <p>文章</p>
150
-
151
- <H2 id=beforestart>文章</h2>
152
-
153
- <p>文章</h2>
154
-
155
- <p>文章</h2>
156
-
157
- <p> 文章</p>
158
-
159
- <h2 id=register>文章</h2>
160
-
161
- <p文章</p>
162
-
163
- <p>文章</p>
164
-
165
- <img style="width:350px" src="area.png">
166
-
167
- <h2 id=earnnig>文章</h2>
168
-
169
- <p>文章。</p>
170
-
171
- <img style="width:350px" src="earning.png">
172
-
173
- <h2 id=satisfaction>文章</h2>
174
-
175
- <p>文章</p>
176
-
177
- <img style="width:350px" src="satisfaction.png">
178
-
179
- </div>
180
-
181
- <div id="comment">
182
-
183
- <h2 style="background-color:lightblue;width:300px">発言コメント掲示板</h2>
184
-
185
- <div id="content">
186
-
187
- <form action="" method="post">
188
-
189
- <dl>
190
-
191
- <dd style="margin-bottom:5px">User名</dd><textarea name="user" cols="10" rows="1"></textarea>
192
-
193
- <dd>
194
-
195
- <dt>○発言どうぞ</dt>
196
-
197
- <textarea name="message" cols="50" rows="5"></textarea>
198
-
199
- </dd>
200
-
201
- </dl>
202
-
203
- <div>
204
-
205
- <input type="submit" value="投稿する" />
206
-
207
- <input type="hidden" name="token" value=<?php echo h($_SESSION['token']);?>">
208
-
209
- </div>
210
-
211
- <h3>投稿一覧 (<?php echo count($posts); ?>件) </h3>
212
-
213
-
214
-
215
- <ul>
216
-
217
- <?php if (count($posts)) : ?>
218
-
219
- <?php foreach ($posts as $post) : ?>
220
-
221
- <?php endforeach; ?>
222
-
223
- <?php list($message, $user, $postedAt) = explode("\", $post); ?>
224
-
225
- <li><?php echo h($message); ?> <?php echo h($user); ?> <?php echo h($postedAt); ?></li>
226
-
227
- <?php foreach ($posts as $post) : ?>
228
-
229
- <?php endforeach; ?>
230
-
231
-
232
-
233
- <?php else : ?>
234
-
235
- <li>まだ投稿がありません。</li>
236
-
237
- <?php endif; ?>
238
-
239
- </ul>
240
-
241
-
242
-
243
-
244
-
245
- </div>
246
-
247
- <div style="margin-left:480px" class="scroll_button">
248
-
249
- <a href="#">▲ページTOPへ戻る</a>
250
-
251
- </div>
252
-
253
- </div>
254
-
255
- <div class="col-sm-4">
256
-
257
- <ul>
258
-
259
- <li><a href="#whatauber">文章</a></li>
260
-
261
- <li><a href="#beforestart">文章</a></li>
262
-
263
- <li><a href="#100">文章</a></li>
264
-
265
- <li><a href="#prepare">文章</a></li>
266
-
267
- <li><a href="#register">文章</a></li>
268
-
269
- <li><a href="#area">文章</a></li>
270
-
271
- <li><a href="#earnnig">文章</a></li>
272
-
273
- <li><a href="#satisfaction">文章</a></li>
274
-
275
- <li><a href="#comment"><span style="color:orange">発言コメント掲示板</span></a></li>
276
-
277
-
278
-
279
- </ul><BR>
280
-
281
-
282
-
283
-
284
-
285
- <hr style="width:300px;border-color:#E1F2E3;border-width:15px;border-radius:10px;">
286
-
287
- <ul class="uldelete">
288
-
289
- <th>~作者へのメッセージ~</th>
290
-
291
- <li><a href="mailto:????">お気軽にご質問をどうぞ mail to</li>
292
-
293
-
294
-
295
- </ul>
296
-
297
-
298
-
299
- <hr style="width:300px;border-color:#E1F2E3;border-width:15px;border-radius:10px;">
300
-
301
- <ul class="uldelete">
302
-
303
-
304
-
305
-
306
-
307
- </ul>
308
-
309
- </div>
310
-
311
-
312
-
313
- </div>
314
-
315
- </div>
316
-
317
-
318
-
319
-
320
-
321
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
322
-
323
- <script src="js/bootstrap.min.js"></script>
324
-
325
-
326
-
327
- </body>
328
-
329
- </html>
330
-
331
- ```
332
-
333
-
334
-
335
1
  上記の14行目、
336
2
 
337
3
  ```