<?php 
session_start();
$bt="携手改善";
include("../head.php");
include("../conn.php");
include_once("../function.php");
$sid = sqlstr($_COOKIE['dl']);
$uin=mysql_fetch_array(mysql_query("select * from user where sid='$sid'"));
$id=$uin['id'];
if(!$uin){
header("Location:../login.php");
exit;//没登录就跳转到登录页面
}
$z=$_GET["z"];
if($z==1){

$time=time();//用于记录时间
$hf="dayin";
$text=htmlspecialchars($_POST["txt"]);
$txt=sqlstr(nl2br($text));
if($txt==Null){
echo '<br/><font color="red">出现错误</font><br/>你什么都不写，你想表达什么呢？写一点吧。<br/><br/>';
}elseif(mb_strlen($txt,'utf-8')>200){
echo "提建议的字数不能大于200字哦，意见太多联系大隐吧<br/><br/>";
}else{
if($_SESSION['text']!=$txt){
$_SESSION['text']="${txt}";
mysql_query("INSERT INTO tg(id,txt,hf,time) VALUES ('$id','$txt','$hf','$time')");
header("Location:index.php");
exit;//发布成功跳转到首页
}else{
echo "<br/><br/><font color='red'>你刚刚已经提过这条建议了</font><br/><br/> ";
}
}


}





?>
<div id="main">
<form action="submit.php?z=1" method="POST">
<p>对一线印象的建议:</p><p><textarea name="txt" wrap="virtual" style="width:90%;height:150px;" class="kuang"></textarea></p>
<br/>
<input class="libbtn" name="libreg" type="submit" value="提交" />　　<a href="index.php">返回>></a></form>
<br/><font color=red>*</font>感谢支持一线印象，请你用心的提出建议，让我们携手改善。</div><br/>

<?php include("../footer.php"); ?>