<?php
include 'news/db.php';
include 'news/config.php';
$sendto = 'Ronald';
function showguestform(){
?>
<form method="post" action="">
Naam: <input type="text" name="guestname" value="<?php echo htmlentities($_POST['guestname']); ?>" /><br /><br />
Email:   <input type="text" name="guestemail" value="<?php echo htmlentities($_POST['guestemail']); ?>" /><br /><br />
Bericht:   <textarea name="guestmessage"><?php echo htmlentities($_POST['guestmessage']); ?></textarea><br /><br />
<input type="submit" name="guests1" value="Bericht verzenden" />
</form>
<?php
}
if(!$_POST['guests1']){
showguestform();
}else{
if(!$_POST['guestname']){
echo "Vul je naam in.<br />";
showguestform();
}elseif(!$_POST['guestemail']){
echo "Vul je email adres goed in ! anders krijg je geen antwoord.<br />";
showguestform();
}elseif(!$_POST['guestmessage']){
echo "Bericht<br />";
showguestform();
}else{
$guestid = DataAccess::fetch("SELECT uid FROM $newsusers WHERE user = ?", "Guest");
$guestid = $guestid['0']['uid'];
$title = "New message from " . slash2($_POST['guestname']);
$message = "Email address: " . slash2($_POST['guestemail']) . "\n\r\n\r" . slash2($_POST['guestmessage']);
$sentfrom = $guestid;
$sentto = DataAccess::fetch("SELECT uid FROM $newsusers WHERE user = ?", $sendto);
$sendto = $sentto['0']['uid'];
$viewed = 1;
$posted = time();
DataAccess::put("INSERT INTO $newsprivate (title,message,sentfrom,sentto,viewed,posted) VALUES (?,?,?,?,?,?)", $title, $message, $sentfrom, $sentto, $viewed, $posted);
echo "Je bericht is verstuurd naar Tktrekker, we zullen zo spoedig mogelijk antwoorden";
}
}
?>
<?php
include 'news/db.php';
include 'news/config.php';
$sendto = 'Ronald';
function showguestform(){
?>
<form method="post" action="">
Naam: <input type="text" name="guestname" value="<?php echo htmlentities($_POST['guestname']); ?>" /><br /><br />
Email:   <input type="text" name="guestemail" value="<?php echo htmlentities($_POST['guestemail']); ?>" /><br /><br />
Bericht:   <textarea name="guestmessage"><?php echo htmlentities($_POST['guestmessage']); ?></textarea><br /><br />
<input type="submit" name="guests1" value="Bericht verzenden" />
</form>
<?php
}
if(!$_POST['guests1']){
showguestform();
}else{
if(!$_POST['guestname']){
echo "Vul je naam in.<br />";
showguestform();
}elseif(!$_POST['guestemail']){
echo "Vul je email adres goed in ! anders krijg je geen antwoord.<br />";
showguestform();
}elseif(!$_POST['guestmessage']){
echo "Bericht<br />";
showguestform();
}else{
$guestid = DataAccess::fetch("SELECT uid FROM $newsusers WHERE user = ?", "Guest");
$guestid = $guestid['0']['uid'];
$title = "New message from " . slash2($_POST['guestname']);
$message = "Email address: " . slash2($_POST['guestemail']) . "\n\r\n\r" . slash2($_POST['guestmessage']);
$sentfrom = $guestid;
$sentto = DataAccess::fetch("SELECT uid FROM $newsusers WHERE user = ?", $sendto);
$sentto = $sentto['0']['uid'];
$viewed = 1;
$posted = time();
DataAccess::put("INSERT INTO $newsprivate (title,message,sentfrom,sentto,viewed,posted) VALUES (?,?,?,?,?,?)", $title, $message, $sentfrom, $sentto, $viewed, $posted);
echo "Je bericht is verstuurd naar Tktrekker, we zullen zo spoedig mogelijk antwoorden";
}
}
?>