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

📄 list.php

📁 php做的一个同学录网站,功能齐全. 后台管理非常方便,有需要的同学可以下载测试.
💻 PHP
字号:
<?php
include("pwdsuper.php");
include("connect.inc.php");
include("char.inc.php");
//  session_start();
$master_nickname_session="集中营论坛";
function showlist()
  {
    global $orderlist,$selstr,$userid;
    echo "<ul>";
    $outtext="";
    $layer=1;
   while($outarray=mysql_fetch_array($orderlist))
    {

     while($layer!=$outarray["layer"])
      {
        if ($outarray["layer"]>$layer)
        {
          $outtext=$outtext."<ul>";
          $layer=$layer+1;
        }
          else
        {
          $outtext=$outtext."</ul>";
          $layer=$layer-1;
        }

      }
      $outtext=$outtext."<li>";
      $outtext=$outtext."<img src=images/".$outarray["expression"].">";
      $outtext=$outtext."<a href='showannounce.php?userid=".$userid."&rootid=".(string)$outarray["rootid"]."&id=".(string)$outarray["id"]."' target='bottom'>";
      if ($outarray["length"]==0){$t=" <无内容>";}
      else{$t=" "; }
      $outtext=$outtext.htmlspecialchars($outarray["topic"].$t);
      $outtext=$outtext."</a> - <strong>";
      $bytestr="(".(string)$outarray["length"];
      if ($outarray["length"]+1==1)
        {
          $bytestr=$bytestr." Byte)";
        }else{
          $bytestr=$bytestr." Bytes)";
        }
        $outtext=$outtext.htmlspecialchars($outarray["vnickname"]);
      $outtext=$outtext." </strong><font color=red><em>".$outarray["dateandtime"]."</em></font> [ID:".(string)$outarray["id"]." 点击:".$outarray["hits"]."] ".$bytestr." <font color='red'>(".(string)$outarray["child"].")</font>".chr(13).chr(10);
      $nowdatetime=strftime('%m/%d/%Y %H:%M:%S %p');
      list($date,$time,$amorpm)=explode(" ",$nowdatetime);
      list($m1,$d,$y)=explode("/",$date);
      //list($h,$m2,$s)=explode(":",$time);
      $newd=$d-1;
      if($newd<10)$newd="0".$newd;
      list($date2,$time2,$amorpm2)=explode(" ",$outarray["dateandtime"]);
      list($y2,$m12,$d2)=explode("-",$date2);
      //list($h2,$m22,$s2)=explode(":",$time2);
        if(($y2.$m12.$d2)>($y.$m1.$newd))
        {
          $outtext=$outtext."<img src='images/new.gif'>".chr(13).chr(10);
        }
      echo $outtext."</li>";
      $outtext="";
    }
    if ($layer!=0)
    {
      for ($i=1; $i<$layer; $i=$i+1)
      {
      if(empty($outtext)){$outtext="";}
      $outtext=$outtext."</ul>";
      }
    }
    $outtext=$outtext."</ul>";
    echo $outtext;
  }

function showpage($boardtype,$boardmaster,$totalannounce,$userid,$mailstr1,$mailstr2)//天头地头。
  {
    global $maxannounce,$totalannounce,$currentpage;
    //echo "<table border='1' width='98%' cellspacing='0' bordercolorlight='#000000' bordercolordark='#FFFFFF'  cellpadding='0'><tr>";
    //echo "<tr><td nowrap bgcolor='#FEEC85'><p align=left>版面:".$boardtype."</td>";
    //echo "<td nowrap bgcolor='#FEEC85'><p align='left'>";
    //echo "版主:".$mailstr1.$boardmaster.$mailstr2."</td>";
    //echo "<td nowrap bgcolor='#FEEC85'><p align='center'><a href=announce.php?userid=".$userid." target=bottom>我要发言</a></td>";
    //echo "<td nowrap bgcolor='#FEEC85'><p align='center'><a href=list.php?userid=".$userid."&amp;page=1>刷新浏览</a></td>";
echo '<form name="form1" method="post" action=list.php?userid='.$userid.'>';
echo '<table width="98%" border="1" cellspacing="1" cellpadding="0" bordercolordark="#009900" bordercolorlight="#009900">';
echo '<tr bgcolor="#83d160">';
echo '<td nowrap><div align="center">41197集中营论坛</div></td>';
echo '<td nowrap><div align="center"><a href=announce.php?userid='.$userid.' target=bottom>我要发言</a></div></td>';
echo '<td nowrap><div align="center"><a href=list.php?userid='.$userid.'&page=1>刷新浏览</a></div></td>';
echo "<form method=Post action=list.php?userid=".$userid.">";
echo "<form method=Post action=list.php?userid=".$userid.">";
    if ($totalannounce%$maxannounce==0)
    {
      $n=floor($totalannounce/$maxannounce);
    }else{
      $n=floor($totalannounce/$maxannounce+1);
    }
    //echo "<form method=Post action=list.php?userid=".$userid.">";
//    echo "<td nowrap align='center' bgcolor='#FEEC85'>";
echo '<td nowrap><div align="center">';
    if ($currentpage<2)
    {
      echo "首页 前页&nbsp;";
    }else{
      echo "<a href=list.php?userid=".$userid."&page=1>首页</a>&nbsp;";
      echo "<a href=list.php?userid=".$userid."&page=".($currentpage-1).">前页</a>&nbsp;";
    }
    if ($n+$currentpage<1)
    {
      echo "后页 尾页";
    }else{
      echo "<a href=list.php?userid=".$userid."&page=".($currentpage+1);
      echo ">后页</a> <a href=list.php?userid=".$userid."&page=".$n.">尾页</a>";
    }
    echo "&nbsp;页次:<strong><font color=red>".$currentpage."</font>/".$n."</strong>页</div></td>";
    //echo "<td valign=top align=center nowrap bgcolor='#FEEC85'>";
    echo '<td nowrap><div align="center">';
    echo "转到:<input type='text' name='page' size=3 maxlength=5 class=smallInput value=".$currentpage.">";
    echo "<input class=buttonface type='submit'  value=' Go '  name='B1'></div></td>";
    echo "</tr></table></form>";
  }

?>
<html>

<head>
<meta NAME="GENERATOR" Content="Microsoft FrontPage 3.0" CHARSET="GB2312">
<title>ASP动网论坛</title>
<link rel="stylesheet" type="text/css" href="forum.css">
</head>

<body bgcolor="#dcf6ce" text="#666600" link="#009900" alink="#00FF00" vlink="#006600">
<?
$selStr="()";
if (!empty($lstRefreshBoard))
{
  $userid=$lstRefreshBoard;
} elseif (!empty($userid))
{
  $userid=$userid;
}
$selStr="";
if (!empty($page))
{
  $currentpage=intval($page);
}
  else
{
  $currentpage=1;
}
//$mastersql="select * from zmis41197 where studentnumber=".$userid;
//$masterinfo=@mysql_query($mastersql,$conn)or die("select * from zmis41197 where studentnumber can't exec");
//$masterarray=mysql_fetch_array($masterinfo);
//if (mysql_num_rows($masterinfo)!=0)
//{
//  $m_name=$masterarray["name"];
//  $m_nickname=$master_nickname_session;
//  $master_nickname_session=$masterarray["nickname"];
//  if (trim($masterarray["email"])!="")
  $m_name="歪卜吗思特";
  $m_nickname=$master_nickname_session;
  $master_nickname_session="歪卜吗思特";
  $masteremail="webmaster@41197.com";
  if (trim($masteremail)!="")
  {
    $mailStr1="<a href='mailto:".trim($masteremail)."'>";
    $mailStr2="</a>";
  }
    else
  {
    $mailStr1="";
    $mailStr2="";
  }

  if ($userid>0)
  {
    //$sql="select id,userid from guestbook where userid=".$userid." and parentid=0 ORDER BY id desc";
    $sql="select id from guestbook where parentid=0 ORDER BY id desc";
    $idquery=mysql_query($sql,$conn);
     if (mysql_num_rows($idquery)!=0)
    {

      $totalannounce=mysql_num_rows($idquery);

      $i=0;
      if ($currentpage==1)
      {
       while($idarray=mysql_fetch_array($idquery))
        {
          if (empty($selstr))
          {
            $selstr="";
            $selstr=$selstr.(string)$idarray["id"];
          }
            else
          {
            $selstr=$selstr.",".(string)$idarray["id"];
          }
          $i=$i+1;
          if ($i>=$maxannounce)
          {
            break;
          }
        }
      }
        else
      {
        if (($currentpage-1)*$maxannounce<$totalannounce)
        {

          mysql_data_seek($idquery,($currentpage-1)*$maxannounce);
          //$maxannounce;
          //$bookmark=;
          //while(!($rs==0))
       while($idarray=mysql_fetch_array($idquery))
          {
            if (empty($selstr))
            {
             $selstr="";
              $selstr=$selstr.(string)$idarray["id"];
            }
              else
            {
            $selstr=$selstr.",".(string)$idarray["id"];
            }

            $i=$i+1;
            if ($i>=$maxannounce)
            {
              break;
            }
          }
        }
          else
        {
          $currentpage=1;
       while($idarray=mysql_fetch_array($idquery))
          {
            if (empty($selstr))
            {
              $selstr="";
              $selstr=$selstr.(string)$idarray["id"];
            }
              else
            {

              $selstr=$selstr.",".(string)$idarray["id"];
            }
            $i=$i+1;
            if ($i>=$maxannounce)
            {
              break;
            }
          }
        }
      }
      if(empty($selstr))
      {
      $selstr="()";
      }
      else
      {
      $selstr="(".$selstr.")";
      }
      if ($selstr!="()")
      {
        $sql="select * from guestbook where (rootid in ".$selstr.") ORDER BY rootid desc,orders ";
      }
        else
      {
        $sql="select * from guestbook ORDER BY rootid desc,orders ";
      }
    }
    else
    {
    echo "<p> 版面:".$master_nickname_session."<br>版主:".$mailStr1.$m_name.$mailStr2."<br>";
    echo " 本论坛无内容 ";
    echo "<p><a href='announce.php?userid=".$userid."' target=".chr(34)."bottom".chr(34).">我要发言</a> <a href='list.php?userid=".$userid."'>刷新浏览</a> ";
    exit();
    }
    $orderlist=mysql_query($sql,$conn);
    showpage($m_nickname,$m_name,$totalannounce,$userid,$mailStr1,$mailStr2);
    showlist();
    showpage($m_nickname,$m_name,$totalannounce,$userid,$mailStr1,$mailStr2);
  }
    else
  {
    echo "<p> 版面:".$master_nickname_session."<br>版主:".$mailStr1.$m_name.$mailStr2."<br>";
    echo " 本论坛无内容 ";
    echo "<p><a href='announce.php?userid=".$userid."' target=".chr(34)."bottom".chr(34).">我要发言</a> <a href='list.php?userid=".$userid."'>刷新浏览</a> ";
  }
//}
//  else
//{
//  echo "该论坛不存在!";
//}
?>
</body>
</html>

⌨️ 快捷键说明

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