<?php //session_start();
  require('includes/application_top.php');
// the following cPath references come from application_top.php
?>
<?php include('conn_onlineanswer.php');?>
<?php
if ($_REQUEST['ac']=='add'){
   $title=$_REQUEST['title'];
   $content=$_REQUEST['content'];
   echo $title.$content.$_SESSION['customer_id'].$_SESSION['customer_first_name'];
   $dateTimeStr = date("Y-m-d H:i:s");
   $sql="insert into answer(userid,title,neirong,leixin,date) VALUES ('".$_SESSION['customer_id']."','".$title."','".$content."',1,'#".$dateTimeStr."#')"; 
  // $sql="insert into answer(userid,title,answer,leixin,date) VALUES ('".$_SESSION['customer_first_name']."','".$title."','".$content."',1,'#".$dateTimeStr."#')"; 
   $result=mysql_query($sql);
   echo "<script>location.href='index_online.php';</script>";
}
else if($_REQUEST['ac']=='result'){
   $id=$_REQUEST['id'];
   $dateTimeStr = date("Y-m-d H:i:s");
   $sql="update answer set leixin=4,date='".$dateTimeStr."' where id=".$id.""; 
   $result=mysql_query($sql);
   //echo "update answer set leixin=4,date='#".$dateTimeStr."#' where id=".$id.""; 
   echo "<script>location.href='index_online.php';</script>";
}
?>