<?
// set all
needed
variables to
connect with
MySQL
database
$user =
"root"
;;
$pass =
"";
$host =
"localhost
";
$dbdb =
"wtcom&quo
t;;
// connect
to MySQL
database
if
(!mysql_select_
db($dbdb,
mysql_connect($
host, $user,
$pass)))
// give
error message
if the
connection
could not be
established
echo
"Sorry, de
database kan
niet geopend
worden.";<
br />
// unset
all
variables
unset($user);
unset($pass);
unset($host);
unset($dbdb);
$table =
"reacties&
quot;;
//-- insert
reaction to
database
if
($_POST['at']
&&
($_POST['door']
&&
$_POST['msg']))
{
$sql3 =
"INSERT
INTO " .
$table . "
(id, door,
email, msg, at,
tid, ip, fid)
VALUES ('',
'" .
stripslashes($_
POST['door']) .
"',
'" .
stripslashes($_
POST['email'])
. "',
'" .
stripslashes($_
POST['msg']) .
"',
'" .
$_POST['at'] .
"',
'" .
$_POST['id'] .
"',
'" .
$_SERVER['$REMO
TE_ADDR'] .
"',
'" . $fid
.
"')";
$res3 =
mysql_query($sq
l3);
if
($res3)
{
if
($fid)
$insert =
"<p>
<span
class=here>B
edankt voor het
reageren!</s
pan></p&g
t;";
else
$insert =
"<p>
<span
class=here>B
edankt voor het
reageren
$door!</span
></p>&
quot;;
}
else
{
$insert =
"<p>
<span
class=here>S
orry, je
reactie is niet
opgeslagen,
probeer het
opnieuw of neem
contact met ons
op.</span>
;</p>&quo
t;;
}
$fid =
"";
$door =
"";
$email
=
"";
$msg =
"";
}
//-- not
enough data
elseif
($_POST['at'])<
br />
{
$insert =
"<p>
<span
class=kopje>
Je bent je naam
of bericht
vergeten.</s
pan></p&g
t;";
}
//--
recieve
reacties from
database
$sql2 =
"SELECT *
FROM " .
$table . "
WHERE tid =
" . $id .
" order by
id";
$res2 =
mysql_query($sq
l2);
echo
"<BR>
;<BR>&
;gt;>
<b>Reacti
es</b><
;P><BR>
;<BR>&quo
t;;
echo
"<table
width=\"94
%\"
border=\"1
\"
cellpadding=\&q
uot;5\"
cellspacing=\&q
uot;0\"
bordercolor=\&q
uot;#597E90\&qu
ot;>";<
br />
echo
"<tr>
;";
echo
"<td
bgcolor=\"
#496979\"&
gt;";
echo
$insert;
//-- show
reactions
if
(mysql_num_rows
($res2) >=
1)
{
while
($row2 =
mysql_fetch_arr
ay($res2))
{
if
($row2[fid])
{
$fsql =
"SELECT
id, name FROM
$table WHERE id
=
$row2[fid]"
;;
$fres =
mysql_query($fs
ql);
$frow =
mysql_fetch_arr
ay($fres);
}
$row2['door'] =
htmlentities($r
ow2['door']);
$row2['email']
=
htmlentities($r
ow2['email']);<
br />
$row2['msg'] =
htmlentities($r
ow2['msg']);
$row2['msg'] =
nl2br($row2['ms
g']);
if
($row2[email])<
br />
echo
"<b>
Reactie door
<a
href=mailto:&qu
ot; .
$row2['email']
.
">"
; .
$row2['door'] .
"</a>
; @ " .
$row2['at'] .
"</b>
; <span
class=small>
<i>("
; . $row2['ip']
. "

</i
></span&g
t;<br>&qu
ot;;
else
echo
"<b>
Gepost door
" .
$row2['door'] .
" @ "
. $row2['at'] .
"</b>
; <span
class=small>
<i>("
; . $row2['ip']
. "

</i
></span&g
t;<br>&qu
ot;;
echo
"$row2[msg
]<P>"
;;
}
}
else
{
echo
"<b>
Er zijn nog
geen
reacties.</b
>";
}
echo
"<hr>
;";
echo
"<p>
";
// door
email at tid
$at =
date('d-m-Y');<
br />
//echo
"<cente
r>";
echo
"<form
method=post
action=" .
$_SERVER['PHP_S
ELF'] .
">"
;;
if
($_GET['id'])
echo
"<input
type=hidden
name=id
value=\"&q
uot; .
$_GET['id'] .
"\"&g
t;";
else
echo
"<input
type=hidden
name=id
value=\"&q
uot; .
$_POST['id'] .
"\"&g
t;";
echo
"<input
type=hidden
name=at
value=\"&q
uot; . $at .
"\"&g
t;";
echo
"<b>
Naam</b>&
lt;br>"
;
echo
"<input
type=text
name=door
value=\"&q
uot; .
htmlentnties($_
POST['door']) .
"\"
size=25><
BR><BR>
;";
echo
"<b>
Email</b>
<br>"
;;
echo
"<input
type=text
name=email
value=\"&q
uot; .
htmlentnties($_
POST['email'])
. "\"
size=25><
BR><BR>
;";
echo
"<b>
Reactie</b&g
t;<br>&qu
ot;;
echo
"<texta
rea name=msg
cols=80
rows=6>"
; .
htmlentnties($_
POST['msg']) .
"</text
area><BR&
gt;<BR>&q
uot;;
echo
"<input
type=submit
name=submit
value=\"Re
ageren!\"&
gt;";
echo
"</form
>";
//echo
"</cent
er>";
echo
"</p>
;";
echo
"<hr>
;";
echo
"<p>
</
p>";
echo
"</td&g
t;";
echo
"</tr&g
t;";
echo
"</tabl
e><P>&
quot;;
?>