<?php
@session_start();
include('inc/conn.php');
include('checkstate.php');

 $radio=$_POST['selects'];
 $content=$_POST['content'];
 $fujian=$_POST['fujian'];
 $userid=$_POST['userid'];
 $time=date('Y-m-d H:i:s',time());
 
  switch($radio){
     case "1":
	    $sql="insert into etw_suggest(userid,suggest,abouts,addtime) value('".$userid."','".$content."','我有疑问' , '".time()."')";
         mysql_query($sql);
		break;

	 case "2":
	    $sql="insert into etw_suggest(userid,suggest,abouts,addtime) value('".$userid."','".$content."','我的建议' , '".time()."')";
  		mysql_query($sql);
        break;

	 case "3":
	      if($_SESSION['vote']=="father"){
			  $childid='';
          } elseif($_SESSION['vote']=="child"){
	          $chatuserid=sql_select("select id from chat_user where username='".$_SESSION['etwcustomer']."'");	
	          $childid=$chatuserid[0][0];
	    }
        $insert="insert into etw_onlines(yid,usernameid,contacter,title,content,senddate,translate,readed,language,childuserid) value(-1,'".$userid."','邮件询盘','邮件询盘','". $content."','".$time."','".time()."', '1','0','".$childid."' )";
		mysql_query($insert);
	    $cha=sql_select("select id from etw_onlines where usernameid='".$userid."' and senddate='".$time."'");
	    $in="insert into etw_translate(chatid,userid,source_content,receivetime,language,type,fujian) value(".$cha[0][0].", ".$userid.",'".$content."', '".time()."','0',1,'".$fujian."' )";
	   mysql_query($in);      
	   break;
	   
	 case "4":
	     $ins="insert into etw_productupd(userid,url,content,edittime,fujian) value(".$userid.",'网站修改','".$content."','".$time."','".$fujian."')";
  		mysql_query($ins);
        break;
  } 
     echo "<script type=\"text/javascript\">window.location.href=\"manage.php\";</script>";
 mysql_close();
?>
