Commit | Line | Data |
---|---|---|
8de51304 H |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\r |
2 | \r | |
3 | <html>\r | |
4 | <head>\r | |
5 | <meta http-equiv="content-type" content="text/html"; charset="utf-8">\r | |
6 | <title>Kniha Návštěv - (c) 2oo6 - Harvie</title>\r | |
7 | <meta http-equiv="cache-control" content="no-cache" />\r | |
8 | \r | |
9 | <style>\r | |
10 | \r | |
11 | body {\r | |
12 | background-color: skyblue;\r | |
13 | text-align: left;\r | |
14 | padding: 4px 10% 4px 10%;\r | |
15 | font-family: Tahoma;\r | |
16 | color: black;\r | |
17 | font-size: small;\r | |
18 | }\r | |
19 | \r | |
20 | .form {\r | |
21 | width: 80%;\r | |
22 | background-color: lightblue;\r | |
23 | border: 2px;\r | |
24 | border-style: solid;\r | |
25 | padding: 10px;\r | |
26 | margin: 4px 10% 4px 10%;\r | |
27 | }\r | |
28 | \r | |
29 | .form input, textarea {\r | |
30 | border: 1px;\r | |
31 | border-style: solid;\r | |
32 | border-color: black;\r | |
33 | width: 100%\r | |
34 | }\r | |
35 | \r | |
36 | .prispevek {\r | |
37 | width: 80%;\r | |
38 | background-color: lightblue;\r | |
39 | border: 2px;\r | |
40 | border-style: solid;\r | |
41 | padding: 10px;\r | |
42 | margin: 4px 10% 4px 10%;\r | |
43 | }\r | |
44 | \r | |
45 | .prispevek .nadpis {\r | |
46 | padding: 2px;\r | |
47 | font-weight: bold;\r | |
48 | text-decoration: none;\r | |
49 | color: black;\r | |
50 | font-size: small;\r | |
51 | border: solid skyblue 2px;\r | |
52 | border-bottom: none;\r | |
53 | _font-size: x-small;\r | |
54 | }\r | |
55 | \r | |
56 | .prispevek .jmeno {\r | |
57 | padding: 2px;\r | |
58 | font-weight: bold;\r | |
59 | font-style: italic;\r | |
60 | text-decoration: none;\r | |
61 | color: darkblue;\r | |
62 | font-size: small;\r | |
63 | border: solid skyblue 2px;\r | |
64 | border-bottom: none;\r | |
65 | border-top: none;\r | |
66 | _font-size: x-small;\r | |
67 | }\r | |
68 | \r | |
69 | .prispevek .datum {\r | |
70 | padding: 2px;\r | |
71 | text-decoration: none;\r | |
72 | color: darkred;\r | |
73 | border: solid skyblue 2px;\r | |
74 | border-top: none;\r | |
75 | font-size: x-small;\r | |
76 | }\r | |
77 | \r | |
78 | .prispevek .text {\r | |
79 | padding: 2px;\r | |
80 | font-size: small;\r | |
81 | border: dotted skyblue 2px;\r | |
82 | background-color: skyblue;\r | |
83 | overflow: hidden;\r | |
84 | _font-size: x-small;\r | |
85 | }\r | |
86 | \r | |
87 | </style>\r | |
88 | \r | |
89 | </head>\r | |
90 | \r | |
91 | <body>\r | |
92 | \r | |
93 | <div class="form">\r | |
94 | <form action="" method="post">\r | |
95 | <h2>Kniha návštěv</h2>\r | |
96 | \r | |
97 | <p>\r | |
98 | <label for="title"><b>Nadpis:</b><br /></label>\r | |
99 | <input type="text" name="title" value="" />\r | |
100 | </p>\r | |
101 | \r | |
102 | <p>\r | |
103 | <label for="name"><b>Jméno:</b><br /></label>\r | |
104 | <input type="text" name="name" value="" />\r | |
105 | </p>\r | |
106 | \r | |
107 | <p>\r | |
108 | <label for="contact"><b>Kontakt:</b><br /></label>\r | |
109 | <input type="text" name="contact" value="EMAIL: ICQ: WWW: TEL/FAX: " />\r | |
110 | </p>\r | |
111 | \r | |
112 | <p>\r | |
113 | <b>Text příspěvku:</b><br />\r | |
114 | <textarea rows="10" cols="30" name="text" title="podporované tagy: [b][/b] [i][/i] [u][/u] - Příliš dlouhá slova budou zkrácena."></textarea>\r | |
115 | </p>\r | |
116 | \r | |
117 | <p>\r | |
118 | <label for="sprot"><b title="Brání knihu proti náhodnému napadení spamboty.">Ochrana proti spamu:</b> <font title="sedm - numericky">[(4)+(3)]=</label>\r | |
119 | <input type="text" name="sprot" value="" />\r | |
120 | </p>\r | |
121 | \r | |
122 | <input type="hidden" name="sent" value="true" />\r | |
123 | \r | |
124 | <p>\r | |
125 | <input type="submit" value="Uložit příspěvek" />\r | |
126 | </p>\r | |
127 | \r | |
128 | </form>\r | |
129 | \r | |
130 | <form action="delete.php">\r | |
131 | <input type="submit" value="Smazat knihu">\r | |
132 | </form>\r | |
133 | \r | |
134 | <?php\r | |
135 | \r | |
136 | if (($_POST["title"]!='') && ($_POST["name"]!='') && ($_POST["text"]!='') && ($_POST["sprot"]=='7')):\r | |
137 | \r | |
138 | //Načtení z POSTu; Převedení tagů na entity; Ořezání bílých znaků na začátku a konci;\r | |
139 | \r | |
140 | $title = $_POST["title"];\r | |
141 | $title = HTMLSpecialChars($title);\r | |
142 | $title = trim($title);\r | |
143 | \r | |
144 | $name = $_POST["name"];\r | |
145 | $name = HTMLSpecialChars($name);\r | |
146 | $name = trim($name);\r | |
147 | \r | |
148 | $contact = $_POST["contact"];\r | |
149 | $contact = HTMLSpecialChars($contatc);\r | |
150 | $contatct = trim($contact);\r | |
151 | \r | |
152 | //Parsování tagů v hlavním textu zprávy\r | |
153 | $text = $_POST["text"];\r | |
154 | $text = HTMLSpecialChars($text);\r | |
155 | \r | |
156 | //Definice vlastních tagů\r | |
157 | /*\r | |
158 | [b]ahoj[/b]\r | |
159 | [i]ahoj[/i]\r | |
160 | [u]ahoj[/u]\r | |
161 | [tt]ahoj[/tt]\r | |
162 | [pre]ahoj[/pre]\r | |
163 | */\r | |
164 | \r | |
165 | $text = str_replace("[b]","<b>", $text);\r | |
166 | $text = str_replace("[/b]","</b>", $text);\r | |
167 | \r | |
168 | $text = str_replace("[i]","<i>", $text);\r | |
169 | $text = str_replace("[/i]","</i>", $text);\r | |
170 | \r | |
171 | $text = str_replace("[u]","<u>", $text);\r | |
172 | $text = str_replace("[/u]","</u>", $text);\r | |
173 | \r | |
174 | $text = str_replace("[tt]","<tt>", $text);\r | |
175 | $text = str_replace("[/tt]","</tt>", $text);\r | |
176 | \r | |
177 | $text = str_replace("[pre]","<pre>", $text);\r | |
178 | $text = str_replace("[/pre]","</pre>", $text);\r | |
179 | \r | |
180 | $text = nl2br($text);\r | |
181 | \r | |
182 | //Zjištění data a času\r | |
183 | //SetLocale("LC_ALL", "Czech"); //Nastavení českého prostředí\r | |
184 | $datum = Date("j/m/Y H:i:s", Time());\r | |
185 | \r | |
186 | //Otevření souboru\r | |
187 | $fp = FOpen ("gbook.txt", "a+");\r | |
188 | \r | |
189 | //Zápis dat do souboru\r | |
190 | FWrite ($fp, "<div class=\"prispevek\">\n");\r | |
191 | \r | |
192 | FWrite ($fp, "<meta name=\"IP\" content=\"" . $_SERVER[REMOTE_ADDR] . "\">\n");\r | |
193 | \r | |
194 | FWrite ($fp, "<div class=\"nadpis\">".$title."</div>\n");\r | |
195 | FWrite ($fp, "<div class=\"jmeno\"> vložil: ".$name." - ".$contact."</div>\n");\r | |
196 | FWrite ($fp, "<div class=\"datum\">".$datum."</div><br />\n");\r | |
197 | \r | |
198 | FWrite ($fp, "<div class=\"text\">\n");\r | |
199 | FWrite ($fp, $text);\r | |
200 | FWrite ($fp, "\n</div></div>\n\n");\r | |
201 | \r | |
202 | //Uzavření souboru\r | |
203 | FClose ($fp);\r | |
204 | \r | |
205 | //Výpisy\r | |
206 | echo "<b><font color=\"red\">Příspěvek byl korektně uložen!<br />Vaše IP adresa: " . $_SERVER[REMOTE_ADDR] . " byla uložena!</font></b> <meta http-equiv=\"refresh\" content=\"1\">";\r | |
207 | \r | |
208 | else:\r | |
209 | \r | |
210 | echo "<b><font color=\"red\" title=\"Nezapomeňte na pole ochrany proti spamu!!!\">Nezapomeňte vyplnit všechna pole!</font></b>";\r | |
211 | \r | |
212 | endif;\r | |
213 | \r | |
214 | ?>\r | |
215 | </div>\r | |
216 | \r | |
217 | <?php\r | |
218 | //Vypsání celého souboru\r | |
219 | $fp = FOpen ("gbook.txt", "r+"); \r | |
220 | FPassThru($fp);\r | |
221 | FClose ($fp);\r | |
222 | ?>\r | |
223 | \r | |
224 | </body>\r | |
225 | </html>\r |