<?php session_start() ?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
$userid=$_POST['userid'];
$etwchataddress=$_POST['etwchataddress'];
$etwchatcontent=$_POST['etwchatcontent'];
$chattime=date("Y-m-d h:i:s");
$etwchatuser=$_POST['etwchatuser'];
if(!session_is_registered("username") || $_SESSION['username']!=$_POST['etwchatemail'])
{
	session_register("usermail");
	$_SESSION['username']=$_POST['etwchatemail'];
}
include("conn.php");
$sql="insert into chat_message(guestmail,sendto,guestaddress,chattime,message,username) values ('".$_SESSION['username']."',$userid,'$etwchataddress','$chattime','$etwchatcontent','$etwchatuser')";
mysql_query("set names 'utf8'",$dbconn);
mysql_query($sql,$dbconn);
$sql="insert into chat_guest(email,address) values ('".$_SESSION['username']."','".$etwchataddress."----".$_SESSION['username']."')";
mysql_query($sql,$dbconn);
mysql_close($dbconn);
 ?>