<?php
//v1.0.4 www.bcoos.net 2006/10 GPL
// www.bcoos.net 2006-09 1.0.2 GPL
	
if ($_POST["title"]!="") {
	include_once("../../mainfile.php");
	include_once("cache/config.php");
if ($xoopsUser) {
	$uid=$xoopsUser->uid();
	} else {
		$uid=0;
	}
$title = $myts->oopsAddSlashesGPC($_POST["title"]);
$email = $myts->oopsAddSlashesGPC($_POST["email"]);
$url   = $myts->oopsAddSlashesGPC($_POST["url"]);
if ($xoopsUser) $username = $xoopsUser->uname();
else $username=$myts->oopsAddSlashesGPC($_POST["username"]);
$message   = $myts->oopsAddSlashesGPC($_POST["message"]);
$datetime  = time();
$poster_ip = $_SERVER['REMOTE_ADDR'];
$sqlinsert = "INSERT INTO ".$db->prefix("xtremguestbook")." (user_id,uname,title,message,post_time,email,url,poster_ip,moderate) VALUES (".$uid.",'".$username."','".$title."','".$message."','".$datetime."','".$email."','".$url."','".$poster_ip."','".$moderate."')";
if ($xoopsUser) {
$xoopsUser->incrementPost($xoopsUser->uid());
}
if ( !$result = $db->query($sqlinsert) ) {
	echo _XTG_ERRORINSERT;
	}
// Send mail to webmaster
if ($sendmail2webmaster==1) {
	$subject = $bcoosConfig['title']." - "._XTG_MODULE_NAME;
	$xoopsMailer =& getMailer();
	$xoopsMailer->useMail();
	$xoopsMailer->setToEmails($bcoosConfig['adminmail']);
	$xoopsMailer->setFromEmail($bcoosConfig['adminmail']);
	$xoopsMailer->setFromName($bcoosConfig['title']);
	$xoopsMailer->setSubject($subject);
	$xoopsMailer->setBody(_XTG_NEWMESSAGE." ".XOOPS_URL."/modules/xtremguestbook/");
	$xoopsMailer->send();
	}
if ($moderate) {
	$messagesent .= "<br />"._XTG_AFTERMODERATE;
	}
redirect_header("index.php",2,$messagesent);
}
?>
