Kword gek!
Heb dit php script voor de specialchars, tis voor een gastenboek, maar als iemand het woord 'foto's' wil posten staat er 'foto\'s'.
Dus lijkt het erop dat die 'word vervangen door \' maar waar beslist dit script dat?
Bij het gedeelte van de htmlspecialchars heb ik al heftig lopen kladderen, maar dit haalt niets uit.
Heb dit php script voor de specialchars, tis voor een gastenboek, maar als iemand het woord 'foto's' wil posten staat er 'foto\'s'.
Dus lijkt het erop dat die 'word vervangen door \' maar waar beslist dit script dat?
Bij het gedeelte van de htmlspecialchars heb ik al heftig lopen kladderen, maar dit haalt niets uit.
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
| <? // --------------------------------------------------------------- // // // Verander de variabelen hieronder. $GastenboekDataBestand = "content/gastenboek.txt"; $GastenboekIPBestand = "content/gastenboek_ip.txt"; $PlaatjesPad = "images/"; $Lettertype = "Arial,Helvetica"; $Lettergrootte = "2"; // Hierna hoef je niks meer te veranderen! // // --------------------------------------------------------------- // echo("<HTML>\n<HEAD>\n<TITLE>Gastenboek</TITLE>\n</HEAD>\n<BODY>\n<CENTER>\n <FONT face='$Lettertype' size=$Lettergrootte>\n\n"); include("$GastenboekDataBestand"); $datum1 = mktime(date("G"), date("i"), date("s"), date("n"), date("d"), date("Y")); $datum = (date("d-m-Y H:i:s", $datum1)); if($REMOTE_ADDR != "127.0.0.1") { $ipadres = $REMOTE_ADDR; } else { $ipadres = $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]; } $bestandje = file("$GastenboekIPBestand"); $lengte = count($bestandje); if ($actie == "voegtoe") { if ($naam == "") { $ok = "nee"; $naamfout = "Je naam is niet ingevuld!<BR>"; } if ($mail == "" || !eregi( "^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$", $mail)) { $ok = "nee"; $mailfout = "Je e-mail adres is incorrect!<BR>"; } if ($woonplaats == "") { $ok = "nee"; $woonplaatsfout = "Je woonplaats is niet ingevuld!<BR>"; } if ($bericht=="") { $ok = "nee"; $berichtfout = " Het bericht is niet ingevuld!<BR>"; } } $form = "<form method=\"POST\" action=\"?pagina=gastenboek&actie=voegtoe\"> <font face=\"Arial\" size=\"2\"> <b>$naamfout$mailfout$woonplaatsfout$berichtfout</b><BR> <table align='center' border=0 cellpadding=0 callspacing=0> <tr> <td width=100 align='left' valign='middle'>Naam:</td><td width=150 align='left' valign='middle'><input type=\"text\" name=\"naam\" class=\"form\" size=\"33\" value=\"$naam\"></td> </tr> <tr> <td width=100 align='left' valign='middle'>E-mail:</td><td width=150 align='left' valign='middle'><input type=\"text\" name=\"mail\" class=\"form\" size=\"33\" value=\"$mail\"></td> </tr> <tr> <td width=100 align='left' valign='middle'>Woonplaats:</td><td width=150 align='left' valign='middle'><input type=\"text\" name=\"woonplaats\" class=\"form\" size=\"33\" value=\"$woonplaats\"></td> </tr> <tr> <td width=100 align='left' valign='top'>Bericht:</td><td width=150 align='left' valign='middle'><textarea rows=\"8\" name=\"bericht\" class=\"form\" cols=\"50\">$bericht</textarea></td> </tr> <tr> <td></td> <td align='left'> <table align='center' border=0 cellpadding=0 callspacing=0><tr> <td width=30 align='center'>[img]images/smilie_smile.gif[/img]</td> <td width=30 align='center'>[img]images/smilie_wink.gif[/img]</td> <td width=30 align='center'>[img]images/smilie_frown.gif[/img]</td> <td width=30 align='center'>[img]images/smilie_sadley.gif[/img]</td> <td width=30 align='center'>[img]images/smilie_sleephappy.gif[/img]</td> <td width=30 align='center'>[img]images/smilie_confused.gif[/img]</td> <td width=30 align='center'>[img]images/smilie_clown.gif[/img]</td> </tr> <tr> <td width=30 align='center'>:a</td> <td width=30 align='center'>:b</td> <td width=30 align='center'>:c</td> <td width=30 align='center'>:d</td> <td width=30 align='center'>:e</td> <td width=30 align='center'>:f</td> <td width=30 align='center'>:g</td> </tr> </table> </td> </tr> <tr> <td></td> <td align='left'> <input type=\"submit\" class=\"formbutton\" value=\"Verzenden\"> </font> </form> </td> </tr> </table> "; if ($actie == "toevoegen") { for($i = 0; $i < $lengte; $i++) { if(eregi($ipadres,$bestandje[$i])) { $Getekend = "Ja"; } else { } } if($Getekend == "Ja") { echo("Je hebt deze maand al een bericht geplaatst!<br>\n"); echo("Klik <a href='?pagina=gastenboek'>hier</a> om terug te gaan naar het gastenboek.\n"); } else { echo $form; } } elseif ($actie == "voegtoe") { for($i = 0; $i < $lengte; $i++) { if(eregi($ipadres,$bestandje[$i])) { $Getekend = "Ja"; } else { } } if($Getekend == "Ja") { echo("Je hebt deze maand al een bericht geplaatst!<br>\n"); echo("Klik <a href='?pagina=gastenboek'>hier</a> om terug te gaan naar het gastenboek.\n"); } else { if ($ok == "nee") { echo $form; } else { $naam = htmlspecialchars($naam); $naam = wordwrap( $naam, 60, "<br>", 1); $woonplaats = wordwrap( $woonplaats, 60, "<br>", 1); $mail = wordwrap( $mail, 60, "<br>", 1); $bericht = htmlspecialchars($bericht); $bericht = ereg_replace("", "", $bericht); $bericht = ereg_replace("<", "&lt;", $bericht); $bericht = ereg_replace(">", "&gt;", $bericht); $bericht = ereg_replace("\:a", "[img]images/smilie_smile.gif[/img]", $bericht); $bericht = ereg_replace("\:b", "[img]images/smilie_wink.gif[/img]", $bericht); $bericht = ereg_replace("\:c", "[img]images/smilie_frown.gif[/img]", $bericht); $bericht = ereg_replace("\:d", "[img]images/smilie_sadley.gif[/img]", $bericht); $bericht = ereg_replace("\:e", "[img]images/smilie_sleephappy.gif[/img]", $bericht); $bericht = ereg_replace("\:f", "[img]images/smilie_confused.gif[/img]", $bericht); $bericht = ereg_replace("\:g", "[img]images/smilie_clown.gif[/img]", $bericht); //$bericht = wordwrap( $bericht, 60, "<br>", 1); $bericht = nl2br($bericht); $nieuw = "\n\n</center></b><b>Naam: </b>$naam<br>\n <b>E-mail: </b><a href=mailto:$mail>$mail</a><br>\n <b>Woonplaats: </b>$woonplaats</a><br>\n <b>Geschreven op: </b>$datum<br>\n <b>Bericht: </b><br>$bericht<br>\n <hr>" .$berichten; $GastenboekBestand = fopen("$GastenboekDataBestand","w"); fputs($GastenboekBestand,"<?"); fputs($GastenboekBestand,"\$berichten=\"$nieuw\""); fputs($GastenboekBestand,"?>"); fclose($GastenboekBestand); $ipfile = fopen("$GastenboekIPBestand", "a"); fputs($ipfile, "$ipadres\n"); fclose($ipfile); echo("Het bericht is toegevoegd!<br>\n"); echo("Klik <a href='?pagina=gastenboek'>hier</a> om terug te gaan naar het gastenboek.\n"); } } } else { echo("<a href='?pagina=gastenboek&actie=toevoegen'><span class=title>Teken het gastenboek</span></a><br><br><hr>\n $berichten<br><a href='?pagina=gastenboek&actie=toevoegen'><center><span class=title>Teken het gastenboek</span></a><br>\n"); } ?> |