Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 41 lines (34 sloc) 1.52 kb
a80fb30 @rosslagerwall Initial commit
authored
1 <?php
5ffe2e9 @rosslagerwall Use major/minor/micro version numbering. Add proper license messages to ...
authored
2 /*
3 Copyright (C) 2011 Ross Lagerwall <rosslagerwall@gmail.com>
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
a80fb30 @rosslagerwall Initial commit
authored
18 if ($_POST['page'] != '' && $_POST['name'] != '' && $_POST['comment'] != '' && file_exists($_POST['page'].".php")) {
19 $name = str_replace("~", "", $_POST['name']);
20 $comment = str_replace("~", "", $_POST['comment']);
21
22 $name = strip_tags($name);
23 $comment = strip_tags($comment);
24
f69f531 @caffeinewriter Replaced the str_replace newlines with the nl2br() function. Writing dat...
caffeinewriter authored
25 $comment = nl2br($comment, TRUE);
3d63de9 @rosslagerwall Replace newlines to make multiline comments work after f69f531
authored
26 $comment = str_replace(array("\r\n", "\r", "\n"), "", $comment);
a80fb30 @rosslagerwall Initial commit
authored
27 $name = substr($name, 0, 100);
28 $comment = substr($comment, 0, 5000);
29
30 $tfile = $_POST['page']."c.txt";
31 if (file_exists($tfile)) {
32 $str = file_get_contents($tfile)."\n";
b5cda91 @rosslagerwall Silence a warning by setting variable
authored
33 } else {
34 $str = '';
a80fb30 @rosslagerwall Initial commit
authored
35 }
f69f531 @caffeinewriter Replaced the str_replace newlines with the nl2br() function. Writing dat...
caffeinewriter authored
36 $str .= $name."~".time()."~".$comment;
a80fb30 @rosslagerwall Initial commit
authored
37 file_put_contents($tfile, $str);
38 }
39 header("Location: ". $_POST['page'].".php");
40 ?>
Something went wrong with that request. Please try again.