
<?php 
require "../Run.php";
echo head(class_name($_GET['cid'],'cn',$wapid)).'<body>';
if($_GET['action'] == 'add'){
 if($_POST['title'] == NULL|| $_POST['content'] == NULL){
   die('标题内容均不能为空！');
   }
   $D = date("Y-m-d-H-i");
  $sql = "INSERT INTO liuyan(title,name,content,gro,time,siteid)VALUES
  ('{$_POST['title']}','{$_POST['name']}','{$_POST['content']}','{$_GET['cid']}','{$D}','{$wapid}')";
  $liuyan = mysql_query($sql);
    if($liuyan && mysql_affected_rows()>0){
	echo '<div class="tip">留言成功[<a href="list.php?cid='.$_GET['cid'].'">返回</a>]</div>';
	}else{
	echo '<div class="tip">留言失败[<a href="list.php?cid='.$_GET['cid'].'">返回</a>]</div>';
	}
}else{
echo '<div class="title"><a href="list.php?cid='.$_GET['cid'].'&">留言板</a>|发表留言</div>';
echo '<div class="content">
<form method="post" action="add.php?action=add&cid='.$_GET['cid'].'">';
echo '<input name="title" type="text" value="标题"/><br>';
echo '<input name="name" type="text" value="您的姓名"/><br>';
echo '<textarea name="content" >留言内容</textarea><br>';
echo '<input type="submit" value="发表留言"/>
</form></div>';
}

echo '</body></html>';
?>