<?php
require_once('php/head.php');
if ($my['isadmin']=="2") {
echo "<script>alert('对不起,您的账号存在异常!',top.location='index.php')</script>";
exit;
}
$id = $_GET['id'];
$msg= mysqli_query($conn,"select * from msg where id=$id");
$msg = mysqli_fetch_assoc($msg);
$uid = $msg['uid'];
$mys = mysqli_query($conn,"select * from user where id = $uid");
$mys = mysqli_fetch_assoc($mys);
$nodeid=$msg['node'];
$node = mysqli_query($conn,"select * from node where id = $nodeid");
$node = mysqli_fetch_assoc($node);
$zid=$mys['id'];
$mid=$my['id'];
$day = $msg['day'];
if ($msg['content']==""){
echo "<script>location='404.php'</script>";
}
$biaoti=mb_substr(strip_tags($msg['content']),0,40,utf8);
?>
<title><?php echo $biaoti;?>-<?php echo $setup['jiesao'];?></title>
<link rel="stylesheet" href="css/viewer.min.css">
<div id="mian" class="container">
<?php require_once('home_zuo.php'); ?>
<div id="col" class="col-md-7">
<div class="panel panel">
<div class="panel-body">
<div class="media">
<div class="media-left">
<a href="user.php?id=<?php echo $mys['id'];?>"><img id="head" class="lazy" src="img/ico/timg.gif" data-original="img/<?php echo $mys['tou'];?>" width="150" height="150"></a>
</div>
<div class="media-body">
<a href="user.php?id=<?php echo $mys['id'];?>"><p ><strong><?php echo $mys['username'];?></strong></p></a>
<p id="yichu" class="text-muted"><?php echo date( "Y-m-d H:i", $day);?> </p>
</div>
<h4><?php echo nl2br($msg["content"]);?></h4>
<div id="dagonge">
<?php
$tuid=$msg['upload'];
$tupian = mysqli_query($conn,"select * from img where msg = 1 and tid = $tuid");
while($rows = mysqli_fetch_array($tupian))
{
?>
<a id="link" href="#" data-toggle="modal" data-target=".bs-example-modal-sm" onclick="document.getElementById('aaa').src='upload/<?php echo $rows['tu'];?>';">
<img id="gonge" class="pic01" src="upload/<?php echo $rows['tu'];?>" width="40%">
</a>
<?php
}
?>
</div>
<?php
if ($msg['lian']!=""){
if ($zid==$mid) {
$lian=$msg['lian'];
echo "<div class='well'><p id='link'>$lian</p></div>";
}else{
$sql="select * from reply where tid='{$id}' and uid ='{$mid}'";
$rst= mysqli_query($conn,$sql);
$row=mysqli_fetch_assoc($rst);
if ($row) {
$lian=$msg['lian'];
echo "<div class='well'><p id='link'>$lian</p></div>";
}else{
$jiage=$msg['jiage'];
echo "<div class='well'><p><i class='fa fa-exclamation-triangle'></i> 主题含有隐藏内容回复可见</p></div>";
}
}
}
?>
<?php
if(isset($_SESSION['userid'])){
?>
<ul class="pager">
<?php
if ($zid==$mid){
?>
<li><a id="fanye" target="fraSubmit" onclick="return confirm('确定删除帖子吗?')" href="php/msg_delete.php?id=<?php echo $msg['id'];?>&tid=<?php echo $msg['upload'];?>"> 删除</a><li>
<?php
}else{
?>
<?php
$uid = $_SESSION['userid'];
$sql="select * from save where tid='{$id}' and uid ='{$uid}'";
$rst= mysqli_query($conn,$sql);
$row=mysqli_fetch_assoc($rst);
if (!$row){
?>
<li><a class="text-muted" id="save" href="javascript:void(0)"> 喜欢</a></li>
<?php
}else{
?>
<li><a class="text-muted" id="save" href="javascript:void(0)">已喜欢</a></li>
<?php
}
?>
<?php
}
?>
</ul>
<?php
}
?>
<h4>最新回复(<?php echo $msg['pid'];?>)</h4>
<?php
if(isset($_SESSION['userid'])){
?>
<a id="di"></a>
<form id="form">
<div class="form-group">
<input type="hidden" name="id" value="<?php echo $id;?>">
<input type="hidden" id="aa" name="zuoid" value="<?php echo $mys['id'];?>">
<input type="hidden" id="bb" name="zid" value="">
</div>
<div class="form-group">
<textarea id="din" class="form-control" name="reply" style="resize:none" onkeydown="checkEnter(event)"></textarea>
</div>
<div class="form-group">
<input class="btn btn-primary" type="button" value="评论" id="submit">
</div>
</form>
<?php
}
?>
<hr>
<?php
if ($msg['pid']=="0"){
?>
<div id="kon"></div>
<?php
}
?>
<?php
$reply=mysqli_query($conn,"select * from reply where tid=$id");
while($row = mysqli_fetch_array($reply))
{
$uid = $row['uid'];
$uid = mysqli_query($conn,"select * from user where id = $uid");
$uid = mysqli_fetch_assoc($uid);
$tid = $row['id'];
$count=mysqli_query($conn,"select count(*) from hui where tid = $tid");
$rs=mysqli_fetch_array($count);
$totalNumber=$rs[0];
?>
<div id="" class="page-header">
<div class="media-left">
<a href="user.php?id=<?php echo $uid['id'];?>"><img id="head" class="lazy" src="img/ico/timg.gif" data-original="img/<?php echo $uid['tou'];?>" width="150" height="150"></a>
</div>
<div class="media-body">
<a href="user.php?id=<?php echo $uid['id'];?>"><p><strong><?php echo $uid['username'];?></strong> <span class="text-muted"><?php echo format_date($row['day']);?></span></p></a>
<p id="link"><span id="<?php echo htmlspecialchars($row['reply']);?>"><?php echo htmlspecialchars($row['reply']);?></span></p>
<a class="text-muted" href="#din" onclick="document.getElementById('aa').value='<?php echo $uid['id'];?>';document.getElementById('bb').value='<?php echo $row['id'];?>';document.getElementById('din').placeholder='回复 <?php echo $uid['username'];?>:<?php echo $row['reply'];?>'">回复</a>
<?php
if($totalNumber!="0"){
?>
<div class="well well-sm">
<?php
$tid=$row['id'];
$hui=mysqli_query($conn,"select * from hui where tid = $tid");
while($rows = mysqli_fetch_array($hui))
{
$uids = $rows['uid'];
$huiuser = mysqli_query($conn,"select * from user where id = $uids");
$huiuser = mysqli_fetch_assoc($huiuser);
?>
<p id="link"><a href="user.php?id=<?php echo $huiuser['id'];?>"><span class="text-muted"><strong><?php echo $huiuser['username'];?></strong> <?php echo format_date($rows['