<?php 
require "../../Run.php";
require "../../include/page.inc.php";


if(LOGIN != 1){
	die(file_get_contents("http://".HTTP_HOST."/login.php?"));
}

function getMessContent(){
	$WAPID = WAPID;
	$id = MYID;
	$sql = "SELECT * FROM message WHERE wapid='{$WAPID}' AND messageid='{$_GET['id']}' AND toid='{$id}'";
	$mess = mysql_query($sql);
	if($mess && mysql_num_rows($mess) > 0){
			$nums = 0;
			
			list($messageid,$sendid,$toid,$title,$content,$read,$time,$wapid) = mysql_fetch_row($mess);
			if($read == 0){
				$sql = 'UPDATE `message` SET `read`=\'1\' WHERE `messageid`=\''.$_GET['id'].'\' AND `wapid`=\''.$WAPID.'\' AND `toid`=\''.MYID.'\'';	
				mysql_query($sql);
			}
				$html .= '<div class="view">[标题]'.$title.'<br>[作者]'.user('nc','id',$sendid).'<hr>'.$content.'<br>'.date('Y-m-d H:i:s',$time).'<hr>[操作]<a href="http://'.HTTP_HOST.'/user/message/messdel.php?id='.$_GET['id'].'">删除</a>.<a href="send.php?toid='.$sendid.'">回复</a></div>';
			
		}else{
				return 0; //记录为空返回空
		}
	return $html;
}

echo head('短信');
	//初始化顶部导航栏参数
	$left = '<a href="http://'.HTTP_HOST.'/user/message/list.php?">返回</a>';
	$center = '短信内容';
	$right = '<a href="http://'.HTTP_HOST.'/index.php?">首页</a>';
	/*$pageurl ='http://'.HTTP_HOST.'/user/message/content.php?'; 
	$NUMS = mysql_num_rows(mysql_query("SELECT * FROM message WHERE wapid='".WAPID."\'"));
	$limit = 15;*/
echo topNav($center,$left,$right);
echo UBB(getMessContent(),WAPID);
/*echo '<div class="showpage">'.page($NUMS,$limit,$pageurl,NULL,'view').'</div>';*/
echo footer(1);
?>