gastenboek
dit boven file wat moet ik er achter zeten ik snap daar niets van achter dit bestand
Dit is wel hetgeen dat ik veronderstel. Zou je de volledige script eens kunnen posten?
dit is wel erg vaag ja, zonder code kunnen wij natuurlijk niet zo veel, dan moet je bij Jomanda zijn :P
Code (php)
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
<?php
$host = 'localhost'; //
$username = ''; // $password = ''; //
$database = ''; //
$ip = ''; //
$bestand = 'gastenboek.php'; //
?>
$host = 'localhost'; //
$username = ''; // $password = ''; //
$database = ''; //
$ip = ''; //
$bestand = 'gastenboek.php'; //
?>
<html>
<head>
<title>
</title>
</head>
<style>
<!--
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.tekst {
color: #333333;
font-family: verdana;
font-size: 11px;
text-decoration: none;
}
.Dtekst {
color: #c0c0c0;
font-family: verdana;
font-size: 11px;
text-decoration: none;
}
.gastenboek {
background: #c0c0c0;
border: 1px #808080 solid;
color: #333333;
font-family: verdana;
font-size: 11px;
text-decoration: none;
}
.velden {
background: #c0c0c0;
border: 1px #808080 solid;
color: #333333;
font-family: verdana;
font-size: 11px;
text-decoration: none;
}
//-->
</style>
<body bgcolor=#000000>
<!--
Is dat het?
wil je echt als ik heb nog meer
Jah hier wordt alleen een variable gedeclareerd ...
jup we willen meer :)
Code (php)
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
<?php
$host = 'localhost'; //
$username = ''; //
$password = ''; //
$database = ''; //
$ip = ''; //
$bestand = 'gastenboek.php'; //
?>
$host = 'localhost'; //
$username = ''; //
$password = ''; //
$database = ''; //
$ip = ''; //
$bestand = 'gastenboek.php'; //
?>
<html>
<head>
<title>
</title>
</head>
<style>
<!--
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.tekst {
color: #333333;
font-family: verdana;
font-size: 11px;
text-decoration: none;
}
.Dtekst {
color: #c0c0c0;
font-family: verdana;
font-size: 11px;
text-decoration: none;
}
.gastenboek {
background: #c0c0c0;
border: 1px #808080 solid;
color: #333333;
font-family: verdana;
font-size: 11px;
text-decoration: none;
}
.velden {
background: #c0c0c0;
border: 1px #808080 solid;
color: #333333;
font-family: verdana;
font-size: 11px;
text-decoration: none;
}
//-->
</style>
<body bgcolor=#000000>
<!--
====================================================
NIET WIJZIGEN ONDER DEZE LIJN
====================================================
//-->
<font class=Dtekst>
Code (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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
<?php
$connect = mysql_connect($host,$username,$password);
mysql_select_db($database, $connect);
echo "<p align=right>\n";
if ($type == 'admin') {
if ($REMOTE_ADDR == $ip) {
if (is_numeric($id)) {
$query = "DELETE FROM gastenboek WHERE id=$id";
mysql_query($query,$connect) or die(mysql_error());
echo "Het bericht is verwijderd
<center>
<a href=gastenboek.php?type=admin class=velden style=\"width:100px; height:17px; cursor: default;\">Administratiepaneel</a>
</center>
<p>
";
}
else {
$query = "SELECT * FROM gastenboek GROUP BY id DESC";
$result = mysql_query($query,$connect);
$nr = mysql_num_rows($result);
while ($msg = mysql_fetch_assoc($result)) {
echo "<br>
<center>
<table cellpadding=0 cellspacing=1 border=0 width=600>
<tr>
<td class=gastenboek width=200>
<a href='mailto:".$msg['email']."' class=tekst>".stripslashes($msg['naam'])."</a>
</td>
<td width=75>
</td>
<td width=200>
</td>
<td class=gastenboek width=150 align=center>
[".$msg['id']."]   [".$msg['ip']."]
</td>
</tr>
";
if(strlen($msg['website']) != 0) {
echo "<tr>
<td class=gastenboek width=200>
<a href='".stripslashes($msg['website'])."' target=_blank class=tekst>".stripslashes($msg['website'])."</a>
</td>
<td width=75>
</td>
<td colspan=2>
</td>
</tr>
";
}
echo "<tr>
<td colspan=4 class=gastenboek>
".stripslashes($msg['msg'])."
</td>
</tr>
<tr>
<td colspan=2 width=50%>
</td>
<td width=200>
</td>
<td class=gastenboek width=150 align=center>
".$msg['posted']."
</td>
</tr>
</table>
<form action=".$bestand." method=post>
<input type=hidden name=type value=admin>
<input type=hidden name=id value=".$msg['id'].">
<input type=submit class=velden style=\"width:150px;\" value=Verwijder>
</form>
</center>
<p>
";
}
echo "<center>
Er staan momenteel <b>".$nr."</b> berichten in het gastenboek.
</center>
<p>
";
}
}
else {
echo "IP-adres ongeldig\n";
}
echo "<center>
<a href=gastenboek.php class=velden style=\"width:100px; height:17px; cursor: default;\">Gastenboek</a>
</center>";
}
elseif ($type == 'add' && $submit) {
$naam = htmlspecialchars($naam);
$website = htmlspecialchars($website);
$msg = htmlspecialchars($msg);
$err = 0;
if (strlen($naam) == 0) {
echo "Vul een (schuil)naam in<br>\n";
$err = 1;
}
if (!ereg("[A-Za-z0-9_-]+([\.]{1}[A-Za-z0-9_-]+)*@[A-Za-z0-9-]+([\.]{1}[A-Za-z0-9-]+)+", $email)) {
echo "Vul het e-mailadres in<br>\n";
$err = 1;
}
if (strlen($msg) == 0) {
echo "Typ een bericht<br>\n";
$err = 1;
}
if (!$err) {
$msg = eregi_replace(":)","<img src=files/icons/smile.gif align=center>", $msg);
$msg = eregi_replace(":s","<img src=files/icons/dizzy.gif align=center>", $msg);
$msg = eregi_replace(":D","<img src=files/icons/lol.gif align=center>", $msg);
$msg = eregi_replace(";)","<img src=files/icons/wink.gif align=center>", $msg);
$msg = eregi_replace(":p","<img src=files/icons/tong.gif align=center>", $msg);
$msg = eregi_replace(":\(","<img src=files/icons/sad.gif align=center>", $msg);
$msg = eregi_replace(":\\\'\(","<img src=files/icons/cry.gif align=center>", $msg);
$msg = eregi_replace(":\|","<img src=files/icons/weird.gif align=center>", $msg);
$msg = eregi_replace(":\\$","<img src=files/icons/shame.gif align=center>", $msg);
$msg = eregi_replace("\(h)","<img src=files/icons/cool.gif align=center>", $msg);
$posted = date("[j-n-Y] [H:i]");
$msg = nl2br($msg);
$query = "INSERT INTO gastenboek (naam, email, website, ip, posted, msg) VALUES ('$naam', '$email', '$website', '$ip', '$posted', '$msg')";
mysql_query($query,$connect);
echo "Het bericht is toegevoegd";
echo "<center>
<a href=gastenboek.php class=velden style=\"width:100px; height:17px; cursor: default;\">Terug</a>
</center>
";
}
else {
Form();
}
}
elseif (($type == 'add' && !$submit) || $err) {
$email = htmlspecialchars($email);
Form();
}
else {
echo "<a href=".$bestand."?type=add class=Dtekst>Teken gastenboek</a>\n";
if(!is_numeric($page)) $page = 0;
$begin = $page * 10;
$eind = $begin + 10;
$query = "SELECT * FROM gastenboek ORDER BY id DESC LIMIT $begin,$eind";
$result = mysql_query($query,$connect) or die(mysql_error());
$rows = mysql_num_rows($result);
if (!$rows) {
echo "<center>
Er zijn momenteel nog geen berichten op deze pagina.";
}
else {
echo "<center>\n";
while ($msg = mysql_fetch_assoc($result)) {
echo "<br>
<table cellpadding=0 cellspacing=1 border=0 width=600>
<tr>
<td class=gastenboek width=200>
<a href='mailto:".$msg['email']."' class=tekst>".stripslashes($msg['naam'])."</a>
</td>
<td width=75>
</td>
<td colspan=2 width=50%>
</td>
</tr>
";
if(strlen($msg['website']) != 0) {
echo "<tr>
<td class=gastenboek width=200>
<a href='".stripslashes($msg['website'])."' target=_blank class=tekst>".stripslashes($msg['website'])."</a>
</td>
<td width=75>
</td>
<td colspan=2 width=50%>
</td>
</tr>
";
}
echo "<tr>
<td colspan=4 class=gastenboek>
".stripslashes($msg['msg'])."
</td>
</tr>
<tr>
<td colspan=2 width=50%>
</td>
<td width=200>
</td>
<td class=gastenboek width=150 align=center>
".$msg['posted']."
</td>
</tr>
</table>
";
}
if ($page) {
echo "<a href=".$bestand."?page=".($page - 1)." class=velden style=\"width:100px; height:17px; cursor: default;\">Vorige</a> ";
}
$query = "SELECT * FROM gastenboek GROUP BY id DESC LIMIT ".($eind + 1).",".($eind + 2);
$result = mysql_query($query,$connect) or die(mysql_error());
$rows = mysql_num_rows($result);
if ($rows) {
echo "<a href=".$bestand."?page=".($page + 1)." class=velden style=\"width:100px; height:17px; cursor: default;\">Volgende</a>";
}
}
if ($REMOTE_ADDR == $ip) {
echo "<p>
<a href=".$bestand."?type=admin class=velden style=\"width:200px; height:17px; cursor: default;\">Administratiepaneel</a>
</center>
";
}
}
function Form() {
global $naam, $email, $website, $msg, $bestand;
echo "Velden met een * dienen te worden ingevuld
<center>
<form action=".$bestand." method=post>
<input type=hidden name=submit value=yes>
<input type=hidden name=type value=add>
<table cellpadding=0 cellspacing=1 border=0>
<tr>
<td width=50% class=Dtekst>
Naam*:
</td>
<td width=50%>
<input type=text style=\"width: 150px;\" name=naam value=\"".stripslashes($naam)."\" class=velden>
</td>
</tr>
<tr>
<td width=50% class=Dtekst>
E-mail*:
</td>
<td width=50%>
<input type=text style=\"width: 150px;\" name=email value=\"".stripslashes($email)."\" class=velden>
</td>
</tr>
<tr>
<td width=50% class=Dtekst>
Website:
</td>
<td width=50%>
<input type=text style=\"width: 150px;\" name=website value=\"".stripslashes($website)."\" class=velden>
</td>
</tr>
<tr>
<td colspan=2 class=Dtekst>
Bericht*:<br>
<textarea name=msg style=\"width:100%; height=50px;\" class=velden>".stripslashes($msg)."</textarea>
</td>
</tr>
<tr>
<td colspan=2 align=center valign=top>
<input type=submit value=Toevoegen style=\"width: 100px;\" class=velden> <input type=reset value=wissen style=\"width: 100px;\" class=velden>
</td>
</tr>
<tr>
<td colspan=2 align=center valign=top>
<a href=".$bestand." class=velden style=\"width:100px; height:17px; cursor: default;\">Terug</a>
</td>
</tr>
</table>
</form>
</center>
";
}
mysql_close($connect);
?>
$connect = mysql_connect($host,$username,$password);
mysql_select_db($database, $connect);
echo "<p align=right>\n";
if ($type == 'admin') {
if ($REMOTE_ADDR == $ip) {
if (is_numeric($id)) {
$query = "DELETE FROM gastenboek WHERE id=$id";
mysql_query($query,$connect) or die(mysql_error());
echo "Het bericht is verwijderd
<center>
<a href=gastenboek.php?type=admin class=velden style=\"width:100px; height:17px; cursor: default;\">Administratiepaneel</a>
</center>
<p>
";
}
else {
$query = "SELECT * FROM gastenboek GROUP BY id DESC";
$result = mysql_query($query,$connect);
$nr = mysql_num_rows($result);
while ($msg = mysql_fetch_assoc($result)) {
echo "<br>
<center>
<table cellpadding=0 cellspacing=1 border=0 width=600>
<tr>
<td class=gastenboek width=200>
<a href='mailto:".$msg['email']."' class=tekst>".stripslashes($msg['naam'])."</a>
</td>
<td width=75>
</td>
<td width=200>
</td>
<td class=gastenboek width=150 align=center>
[".$msg['id']."]   [".$msg['ip']."]
</td>
</tr>
";
if(strlen($msg['website']) != 0) {
echo "<tr>
<td class=gastenboek width=200>
<a href='".stripslashes($msg['website'])."' target=_blank class=tekst>".stripslashes($msg['website'])."</a>
</td>
<td width=75>
</td>
<td colspan=2>
</td>
</tr>
";
}
echo "<tr>
<td colspan=4 class=gastenboek>
".stripslashes($msg['msg'])."
</td>
</tr>
<tr>
<td colspan=2 width=50%>
</td>
<td width=200>
</td>
<td class=gastenboek width=150 align=center>
".$msg['posted']."
</td>
</tr>
</table>
<form action=".$bestand." method=post>
<input type=hidden name=type value=admin>
<input type=hidden name=id value=".$msg['id'].">
<input type=submit class=velden style=\"width:150px;\" value=Verwijder>
</form>
</center>
<p>
";
}
echo "<center>
Er staan momenteel <b>".$nr."</b> berichten in het gastenboek.
</center>
<p>
";
}
}
else {
echo "IP-adres ongeldig\n";
}
echo "<center>
<a href=gastenboek.php class=velden style=\"width:100px; height:17px; cursor: default;\">Gastenboek</a>
</center>";
}
elseif ($type == 'add' && $submit) {
$naam = htmlspecialchars($naam);
$website = htmlspecialchars($website);
$msg = htmlspecialchars($msg);
$err = 0;
if (strlen($naam) == 0) {
echo "Vul een (schuil)naam in<br>\n";
$err = 1;
}
if (!ereg("[A-Za-z0-9_-]+([\.]{1}[A-Za-z0-9_-]+)*@[A-Za-z0-9-]+([\.]{1}[A-Za-z0-9-]+)+", $email)) {
echo "Vul het e-mailadres in<br>\n";
$err = 1;
}
if (strlen($msg) == 0) {
echo "Typ een bericht<br>\n";
$err = 1;
}
if (!$err) {
$msg = eregi_replace(":)","<img src=files/icons/smile.gif align=center>", $msg);
$msg = eregi_replace(":s","<img src=files/icons/dizzy.gif align=center>", $msg);
$msg = eregi_replace(":D","<img src=files/icons/lol.gif align=center>", $msg);
$msg = eregi_replace(";)","<img src=files/icons/wink.gif align=center>", $msg);
$msg = eregi_replace(":p","<img src=files/icons/tong.gif align=center>", $msg);
$msg = eregi_replace(":\(","<img src=files/icons/sad.gif align=center>", $msg);
$msg = eregi_replace(":\\\'\(","<img src=files/icons/cry.gif align=center>", $msg);
$msg = eregi_replace(":\|","<img src=files/icons/weird.gif align=center>", $msg);
$msg = eregi_replace(":\\$","<img src=files/icons/shame.gif align=center>", $msg);
$msg = eregi_replace("\(h)","<img src=files/icons/cool.gif align=center>", $msg);
$posted = date("[j-n-Y] [H:i]");
$msg = nl2br($msg);
$query = "INSERT INTO gastenboek (naam, email, website, ip, posted, msg) VALUES ('$naam', '$email', '$website', '$ip', '$posted', '$msg')";
mysql_query($query,$connect);
echo "Het bericht is toegevoegd";
echo "<center>
<a href=gastenboek.php class=velden style=\"width:100px; height:17px; cursor: default;\">Terug</a>
</center>
";
}
else {
Form();
}
}
elseif (($type == 'add' && !$submit) || $err) {
$email = htmlspecialchars($email);
Form();
}
else {
echo "<a href=".$bestand."?type=add class=Dtekst>Teken gastenboek</a>\n";
if(!is_numeric($page)) $page = 0;
$begin = $page * 10;
$eind = $begin + 10;
$query = "SELECT * FROM gastenboek ORDER BY id DESC LIMIT $begin,$eind";
$result = mysql_query($query,$connect) or die(mysql_error());
$rows = mysql_num_rows($result);
if (!$rows) {
echo "<center>
Er zijn momenteel nog geen berichten op deze pagina.";
}
else {
echo "<center>\n";
while ($msg = mysql_fetch_assoc($result)) {
echo "<br>
<table cellpadding=0 cellspacing=1 border=0 width=600>
<tr>
<td class=gastenboek width=200>
<a href='mailto:".$msg['email']."' class=tekst>".stripslashes($msg['naam'])."</a>
</td>
<td width=75>
</td>
<td colspan=2 width=50%>
</td>
</tr>
";
if(strlen($msg['website']) != 0) {
echo "<tr>
<td class=gastenboek width=200>
<a href='".stripslashes($msg['website'])."' target=_blank class=tekst>".stripslashes($msg['website'])."</a>
</td>
<td width=75>
</td>
<td colspan=2 width=50%>
</td>
</tr>
";
}
echo "<tr>
<td colspan=4 class=gastenboek>
".stripslashes($msg['msg'])."
</td>
</tr>
<tr>
<td colspan=2 width=50%>
</td>
<td width=200>
</td>
<td class=gastenboek width=150 align=center>
".$msg['posted']."
</td>
</tr>
</table>
";
}
if ($page) {
echo "<a href=".$bestand."?page=".($page - 1)." class=velden style=\"width:100px; height:17px; cursor: default;\">Vorige</a> ";
}
$query = "SELECT * FROM gastenboek GROUP BY id DESC LIMIT ".($eind + 1).",".($eind + 2);
$result = mysql_query($query,$connect) or die(mysql_error());
$rows = mysql_num_rows($result);
if ($rows) {
echo "<a href=".$bestand."?page=".($page + 1)." class=velden style=\"width:100px; height:17px; cursor: default;\">Volgende</a>";
}
}
if ($REMOTE_ADDR == $ip) {
echo "<p>
<a href=".$bestand."?type=admin class=velden style=\"width:200px; height:17px; cursor: default;\">Administratiepaneel</a>
</center>
";
}
}
function Form() {
global $naam, $email, $website, $msg, $bestand;
echo "Velden met een * dienen te worden ingevuld
<center>
<form action=".$bestand." method=post>
<input type=hidden name=submit value=yes>
<input type=hidden name=type value=add>
<table cellpadding=0 cellspacing=1 border=0>
<tr>
<td width=50% class=Dtekst>
Naam*:
</td>
<td width=50%>
<input type=text style=\"width: 150px;\" name=naam value=\"".stripslashes($naam)."\" class=velden>
</td>
</tr>
<tr>
<td width=50% class=Dtekst>
E-mail*:
</td>
<td width=50%>
<input type=text style=\"width: 150px;\" name=email value=\"".stripslashes($email)."\" class=velden>
</td>
</tr>
<tr>
<td width=50% class=Dtekst>
Website:
</td>
<td width=50%>
<input type=text style=\"width: 150px;\" name=website value=\"".stripslashes($website)."\" class=velden>
</td>
</tr>
<tr>
<td colspan=2 class=Dtekst>
Bericht*:<br>
<textarea name=msg style=\"width:100%; height=50px;\" class=velden>".stripslashes($msg)."</textarea>
</td>
</tr>
<tr>
<td colspan=2 align=center valign=top>
<input type=submit value=Toevoegen style=\"width: 100px;\" class=velden> <input type=reset value=wissen style=\"width: 100px;\" class=velden>
</td>
</tr>
<tr>
<td colspan=2 align=center valign=top>
<a href=".$bestand." class=velden style=\"width:100px; height:17px; cursor: default;\">Terug</a>
</td>
</tr>
</table>
</form>
</center>
";
}
mysql_close($connect);
?>
</tekst>
</body>
</html>
oi oi oi, linkje naar .phps had makkelijker geweest maar ik zal even kijken :)
ik zie dat er nog wat mist, een stukje dat het opstuurt naar de database :)
en dat is waar $bestand heen moet wijzen
dit is echt als
ik heb je naar je gewoon email dat zip file gestuurt wat ik moest downloaden herman
maar dit script is zeker niet af.
er word namelijk gestuurd via post en nergens in het bestand worden die variabelen opgehaald
net zoals de get variabelen die gebruikt worden, die worden ook niet opgehaald
er mist nog een flink stuk script als je het mij vraagt
Mss moet je een simpelere nemen of leren snappen wat er staat (bespaard je een hoop tijd later ipv dat je alles moet vragen ...)