<?php 
require "../Run.php";
require "../include/postHf.fun.php";
//用户信息查询函数
if($login!=1){
ehtml("请登录");
exit;
}
function huifu_user($shibie,$word,$ser){
$wapid = WAPID;
$sql="SELECT {$word},{$shibie} FROM user WHERE {$word}='{$ser}' AND site_u='{$wapid}'";
    $result = mysql_query($sql);
    if($result && mysql_num_rows($result)>0){
    list($a,$b) = mysql_fetch_row($result);
    }
    mysql_free_result($result);
    return $b;
}
//评论详细信息查询函数
function huifu_info($hid,$ser){
    $sql="SELECT hid,{$ser} FROM bbscomm WHERE hid='{$hid}'";  
        $result = mysql_query($sql);      
	    list($hid,$ser) = mysql_fetch_row($result);
		return $ser;
   }

//获取评论作者的真实ID

$userid = huifu_info($_GET['id'],'userid');

//根据资源ID获取所属所属帖子ID

$huifu_gro = huifu_info($_GET['id'],'gro');

//根据真实的ID获取评论作者昵称

$huifu_user = huifu_user('nc','id',$userid);

if($_POST['huifu']=='yes'){
   
   $tip = postHf($_POST['htext'],$id,$wapid,$huifu_gro,$_GET['id'],1000);
   
   if($tip==1){
	
	/*发送短信通知楼主*/
			$title = $nc.'回复了您的留言...';
			
			$content = '您好，'.$nc.' 在论坛的留言"'.huifu_info($_GET['id'],'htext').'"。[br]回复内容[br]：'.$_POST['htext'].'[br]快去看看吧。[url=http://'.HTTP_HOST.'/bbs/content.php?cid='.$_GET['cid'].'&id='.$huifu_gro.']飞机直达现场[/url]...';
			
			$user_id = $userid;
			
	
			
			if(SendMessage($title,$content,$user_id,NULL) == 1){
				$mtip = '已经短信通知楼主了！';
			}else{
				$mtip = '哎呀，楼主没有收到你的短息哦！';
			}
   
	    $tip='<div class="tip">'.$mtip.'.评论成功喽</div>';
		}else{
		$tip='<div class="tip">评论失败</div>';
		}
   }
$html_input='<div class="nav_top"><a href="content.php?cid='.$_GET['cid'].'&id='.huifu_info($_GET['id'],'gro').'"><<返回</a></div>
<div class="subtitle">回复'.$huifu_user.'的评论</div>'.$tip.'<div class="title"><form method="post" action="huifuuser.php?cid='.$_GET['cid'].'&id='.$_GET['id'].'">
           <input type="text" name="htext" value="马上回复">
           <input type="hidden" name="id" value="'.$_GET['id'].'"/>
           <input type="hidden" name="huifu" value="yes"/>
           <input type="submit" value="评论并转发"/>
           </form></div><div class="content">[原文]'.huifu_info($_GET['id'],'htext').'</div>';
		   echo head('回复评论').$html_input.footer(1);
?>