⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 21-9.php

📁 php 和 ajax 开发的一些资料
💻 PHP
字号:
<?php
echo "<html>\n";								//输出标准HTML内容
echo "<head>\n";
echo "<title>\n";
echo "论坛浏览主题显示页面\n";
echo "</title>\n";
echo "</head>\n";
echo "<body>\n";
echo "<link href=\"style.css\" rel=\"stylesheet\" type=\"text/css\">\n";
echo "<div class=\"Frame\">\n";
echo "<div class=\"title\">论坛浏览主题显示页面</div>\n";
echo "<div class=\"main\"></div>\n";
if(!$_GET[id])
{
  echo "<div class=\"title\">没有指定主题ID<p>点<a href=\"history.go(-1)\">这里</a>返回</div>";
  exit();
}
else
{
  require "21-1.php";
  $sql="select * from $bbs_post where id='$_GET[id]' limit 1";
  $result=mysql_query($sql,$my_conn);
  $row=mysql_fetch_array($result);
  if($row[re_id]!=0)
  {
    echo "<div class=\"title\">指定ID不是主题ID<p>点<a href=\"history.go(-1)\">这里</a>返回</div>";
    exit();
  }
  else
  {
	  echo "<script language=\"javascript\">
<!--
var xmlHttp;										//定义变量
function prompt(id)									//向服务器提交内容函数
{
  var endx=event.clientX;							
  var endy=event.clientY;
  obj=document.getElementById(\"user_info\");
  obj.style.left=endx;		//改变指定层的位置
  obj.style.top=endy;		//改变指定层的位置
  var date=new Date();							//定义时间变量
  temp=date.getTime();							//获取当前时间戳记
  xmlHttp=new ActiveXObject(\"Microsoft.XMLHTTP\");		//创建对象
  var SendInfo=\"id=\"+id;
  var url=\"userinfo.php?timestamp=\"+temp;						//定义URL
  xmlHttp.onreadystatechange=handle_f;					//定义句柄函数
  xmlHttp.open(\"POST\",url,true); 
  xmlHttp.setRequestHeader(\"Content-Type\",\"application/x-www-form-urlencoded\");
  xmlHttp.send(SendInfo); 								//向服务器发送请求
}
function handle_f()									//句柄函数
{
  if(xmlHttp.readyState==4)							//如果传递完成
  {
    if(xmlHttp.status==200)							//如果服务器返回OK
    {
      xmlDoc=xmlHttp.responseText;					//获取从服务器返回的text
      obj=document.getElementById(\"user_info\");
      obj.style.display= \"block\";
	  obj.innerHTML=xmlDoc;
    }
    else											//如果服务器没有返回200
    {
      alert(\"执行过程中出现问题,服务器返回:\"+xmlHttp.statusText);
    }
  }
}
function close_div()									//自定义关闭层函数
{
  user_info.style.display=\"none\";							//隐藏层
}
-->
</script>";
	echo "<div id=\"user_info\" class=\"huifu\" style=\"POSITION: absolute;\"></div>";
    $sql2="select id,m_id,type_n from $bbs_type where id='$row[type_id]'";
    $temp=mysql_fetch_array(mysql_query($sql2,$my_conn));
    $sql3="select id,type_n from $bbs_type where id='$temp[1]'";
    $temp2=mysql_fetch_array(mysql_query($sql3,$my_conn));
     echo "<div class=\"huifu\"><a href=\"21-5.php\">论坛首页</a> → <a href=\"21-6.php?id=".$temp2[0]."\">".$temp2[1]."</a> → <a href=\"21-7.php?id=".$temp[0]."\">".$temp[2]."</a>→".$row[title]."  <a href=\"21-8.php?type_id=".$temp[0]."&re_id=".$_GET[id]."\">回复主题</a></div>\n";
    echo "<div class=\"title\">";
    echo "<table width=\"95%\">\n";
    echo "<tr>\n";
    echo "<td width=\"15%\" rowspan=\"2\" class=\"huifu\">";
    $sql4="select id,nickname from $bbs_user where id='$row[poster_id]' limit 1";
    $temp3=mysql_fetch_array(mysql_query($sql4,$my_conn));
    echo "作者:<a href=\"21-14.php?id=".$temp3[0]."\" target=\"_blank\" onmouseover=\"prompt('".$temp3[0]."')\" onmouseout=\"close_div()\">".$temp3[1]."</a><br>\n";
    echo "<br>";
    echo "发贴时间:<br>".$row[p_time];
    echo "<br>";
    echo "<a href=\"21-12.php?id=".$row[0]."\">编辑</a>&nbsp;&nbsp;";
    echo "<a href=\"21-13.php?id=".$row[0]."\">删除</a>";
    echo "</td>\n";
    echo "<td width=\"85%\" class=\"huifu\" height=\"10%\">标题:".$row[title]."</td>\n";
    echo "</tr>\n";
    echo "<tr>\n";
    echo "<td width=\"85%\" class=\"huifu\" height=\"90%\">内容:<br>".$row[content]."</td>\n";
    echo "</tr>";
    echo "</table>";
    echo "</div>";
    $sql_n="select * from $bbs_post where re_id='$_GET[id]'";
    $result=mysql_query($sql_n,$my_conn);
    if(mysql_num_rows($result)>0)
    {
      echo "<div class=\"hf\">以下为回复内容:</div>";
      while($row2=mysql_fetch_array($result))
      {
        echo "<div class=\"title\">";
        echo "<table width=\"95%\">\n";
        echo "<tr>\n";
        echo "<td width=\"15%\" rowspan=\"2\" class=\"huifu\">";
        $sql5="select id,nickname from $bbs_user where id='$row2[poster_id]' limit 1";
        $temp4=mysql_fetch_array(mysql_query($sql5,$my_conn));
        echo "作者:<a href=\"21-14.php?id=".$temp4[0]."\" target=\"_blank\" onmouseover=\"prompt('".$temp4[0]."')\" onmouseout=\"close_div()\">".$temp4[1]."</a><br>\n";
        echo "<br>发贴时间:<br>";
        echo $row2[p_time];
        echo "<br>";
        echo "<a href=\"21-12.php?id=".$row2[id]."\">编辑</a>&nbsp;&nbsp;";
        echo "<a href=\"21-13.php?id=".$row2[id]."\">删除</a>";
        echo "</td>\n";
        echo "<td width=\"85%\" class=\"huifu\" height=\"10%\">标题:".$row2[title]."</td>\n";
        echo "</tr>\n";
        echo "<tr>\n";
        echo "<td width=\"85%\" class=\"huifu\" height=\"90%\">内容:<br>".$row2[content]."</td>\n";
        echo "</tr>";
        echo "</table>";
        echo "</div>";
      }
    }
    $sql="update $bbs_post set v_num=v_num+1 where id='$_GET[id]'";
    mysql_query($sql);
  }
}
echo "</div>";
echo "</doby>";
echo "</html>";
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -