<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>回复列表</title>
</head>

<body><table align="center" style="width:700px;"><tr><td>
<?php 

require "../Run.php";
/*验证用户信息*/
/**/
if($_GET['type']=='list'){
    $tip="欢迎进入回复列表";
	/*回复列表*/
	echo "<form  method=\"post\" action=\"huifu.php\">
 
  <input type=\"input\" name=\"text\" value=\"您想说点什么？\">
  <input type=\"hidden\" name=\"userid\" value=\"".$id."\">
  <input type=\"hidden\" name=\"cid\" value=\"".$_GET['cid']."\">
  <input type=\"hidden\" name=\"id\" value=\"".$_GET['id']."\">
   <input type=\"hidden\" name=\"sid\" value=\"".$sid_info."\">
  <input type=\"submit\" value=\"我要留言\">
</form>";
echo "</td></tr><tr><td>";

      $article=$_GET['id'];          
	  $sql="SELECT articleid,userid,text FROM arthf WHERE articleid='$article' ";
	       $view=mysql_query($sql);
	  /*数据验证*/
	            if($view && mysql_num_rows($view)>0){
	               while(list($articleid,$userid,$text)=mysql_fetch_row($view)){
	                 echo "<table style=\"border:1px solid #efefef;margin:5px;width:100%\"><tr><td style=\"\">";
		             	echo $text;
		        	echo "</td></tr><td style=\"background-clor:#000000;text-align:right;padding-right:40px;color:#000000;\">";
		     	echo "来自".$name."的回复";
			echo "</td></tr></table>";
			};
			 }else{
			 $ts="抱歉 内容获取失败";
			 echo $ts;
			 echo $_POST['text'];
			 echo $_POST['userid'];
			 echo $id;};
	         echo "</td></tr></table>";
	}else{
              $arthf="INSERT INTO arthf(articleid,userid,text)VALUES('{$_POST['id']}','{$_POST['userid']}','{$_POST['text']}')";
	          $arthf=mysql_query($arthf);
              if($arthf && mysql_affected_rows()>0){
              $tip= "您已经成功回复此文章喽！";
	          }else{
	          $tip="哎呀！回复失败！请稍候再试或者联系网站管理员！";
	              };
				  echo $tip;
				  echo "<a href=\"huifu.php?type=list&cid=".$_POST['cid']."&id=".$_POST['id']."&sid=".$_POST['sid']."\">";
				  echo "回到列表";
				  echo "</a>";
				 };
				
 ?>
</body>
</html>
