无为清净楼资源网 Design By www.qnjia.com
本论坛总共用了不到200行代码,执行速度相当快。运行例子在:http://www.hnpts.ha.cn/forum
MYSQL数据库:yxforum
+-------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+----------------+
| id | int(11) | | PRI | 0 | auto_increment |
| dt | datetime | YES | | NULL | |
| tp | varchar(255) | YES | | NULL | |
| ct | text | YES | | NULL | |
| fl | int(11) | YES | | NULL | |
| ip | varchar(20) | YES | | NULL | |
| un | varchar(50) | YES | | NULL | |
| em | varchar(60) | YES | | NULL | |
| num | int(11) | YES | | NULL | |
+-------+--------------+------+-----+---------+----------------+
index.php:
<html>
<head>
<style type="text/css">
<!--
.unnamed1 { font-size: 9pt; font-family: "宋体"}
.unnamed1 A {COLOR: #000088; FONT-SIZE: 9pt; TEXT-DECORATION: none; TEXT-TRANSFORM: none; font-family: "宋体"}
.unnamed1 A:hover {COLOR: #880000; FONT-SIZE: 9pt; TEXT-DECORATION: underline overline; font-family: "楷体_GB2312"}
.unnamed2 { font-size: 12px; color: #9933FF}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#000066" vlink="#0000CC" alink="#000099">
<?$m=mysql_connect("localhost","××××","××××");
mysql_select_db("××××",$m);
?>
<?if ($fl=="") $fl=1;
$hf_fl=$fl;
$q="select * from yxforum where id=".$fl;
$mr=mysql_query($q,$m);
$ra=mysql_fetch_row($mr);
?>
<p align=center><b><?print($ra[2]);?></b><br>
<?if ($fl!=1) {
?>
<small><?printf("(<a href=mailto:%s>%s</a>) ",$ra[7],$ra[6]);?>
</small></p>
<?$alltt=$ra[2];
$lastid=$ra[4];
print("<center><table width=90% border=1><tr><td bgcolor=#dddddd class=unnamed1>".$ra[3]."</tr></table></center>");
print("<br><small>跟随主题:</small>");
}
$q="select * from yxforum where fl=".$fl." order by dt desc";
if ($p=="") $p=0;
$mr=mysql_query($q,$m);
$f=mysql_num_fields($mr);
$ra=mysql_fetch_row($mr);
$i=0; $p1=$p*15; /*跳过指定的页数对应的行*/
while ($i<$p1)
{$i++;
$ra=mysql_fetch_row($mr);
if (! $ra) break;}
?>
<center>
<table border=0 width=732 class="unnamed1">
<tr align="center" valign="top" bgcolor="#FFFFCC">
<td width="186" >最新回应时间
<td width="88">发表人
<td width="414">主题
<td width="44">回应数
</tr>
<?
$x[0]="ffffcc";$x[1]="DEEFFF";$i=1;
while ($ra) /*显示目前的主题*/
{$ys_c=$i%2;
print("<tr height=12 bgcolor=#".$x[$ys_c]."><td align=center>".$ra[1]);
print("<td align=center><a href=mailto:".$ra[7].">".$ra[6]."</a>");
print("<td>");
printf("<a href=index.php?fl=%s>%s</a>",$ra[0],$ra[2]);
print("<td align=center>".$ra[8]);
print("</tr>");
$ra=mysql_fetch_row($mr);
$i++;
if ($i>15) break;
}
?>
</table></center>
<form action=index.php method=get name=F0 onsubmit="document.F0.p.value--;return true;">
<span class=unnamed1>
<?
$alllines=mysql_affected_rows($m);
$pages=$alllines/15;
if ($pages-intval($pages)!=0) $pages=intval($pages)+1;
else $pages=intval($pages);
print("共".$pages."页 第".($p+1)."页 ");
if ($p>0) {printf("<a href=index.php?fl=%s>首页</a> ",$hf_fl);
printf("<a href=index.php?fl=%s&p=%d>上一页</a> ",$hf_fl,$p-1);}
if ($ra) {printf("<a href=index.php?fl=%s&p=%d>下一页</a> ",$hf_fl,$p+1);
printf("<a href=index.php?fl=%s&p=%d>末页</a> ",$hf_fl,$pages-1);}
?>指定第<input type=text size=2 name=p>页
</span>
<span class=unnamed1>
<?if ($hf_fl!=1) {printf("<br><a href=index.php?fl=%s>上一级</a> ",$lastid);
print("<a href=index.php>最高级</a><br>");}
?>
</form><center>
<table width=80% bgcolor=#eeeeff><tr><td class=unnamed1>
<?print(($fl==1)?"加新贴:":"回应:");?>
<form action="addnew.php" method=post name="F1">
姓名:
<input type="text" name="nm" size="15">
<br>
Email:
<input type="text" name="em" size="45">
<br>
标题(必填):
<input type="text" name="tt" size="45" <?if ($fl!=1) print("value=回复:".$alltt);?> >
<input type=hidden name="fl" value="<?print($hf_fl);?>">
<input type=hidden name="p" value="<?print($p);?>">
<br>
正文(必填): <br>
<textarea name="zw" cols="50" rows="10"></textarea>
<input type="submit" name="Submit" value="提 交">
</form>
</tr></table></center>
<hr>
<center>自用论坛程序0.25版 设计工具:PHP+MYSQL<br>
<a href=mailto:fhl@cgi.hnpts.ha.cn>古钺青剑</a> 制作<br><a href=http://www.fhlfox.dhs.org>逍遥飞狐多媒体作坊</a> 2000 </center>
</span>
</body>
</html>
addnew.php:
<?$m=mysql_connect("localhost","×××","×××××");
mysql_select_db("×××××",$m);
$zw=ereg_replace("<","<",$zw);
$zw=ereg_replace(">",">",$zw);
$zw=ereg_replace("n","<br>",$zw);
$zw=ereg_replace(" "," ",$zw);
$tt=ereg_replace("<","<",$tt);
$tt=ereg_replace(">",">",$tt);
if ($nm=="") $nm="无名宝";
if ($em=="") {$nm.="<-- 是一只没有MAIL的菜鸟";$em="No";}
$err=strlen($tt)*strlen($zw);
if ($err==0)
$msg="<font color=red>不要偷懒嘛!把表格填完再提交不迟。</font>";
else {$q="insert into yxforum (dt,tp,ct,fl,ip,un,em,num) values"
."(now(),"".$tt."","".$zw."",".$fl.","".$REMOTE_ADDR."","".$nm."","".$em."",0)";
mysql_query($q,$m);
$q="select num,fl from yxforum where id=".$fl;
$fl_a=$fl;
do { $mr=mysql_query($q,$m);
$ra=mysql_fetch_row($mr);
$num=$ra[0]+1;
$q="update yxforum set dt=now(),num=".$num." where id=".$fl;
$fl=$ra[1];
mysql_query($q,$m);
$q="select num,fl from yxforum where id=".$fl;
} while ($fl>0);
$msg="<font color=green>你的意见已经成功提交!</font>";
}
?>
<html>
<head>
<script language="Javascript">
function go()
{document.location="index.php?fl=<?print($fl_a);?>&p=<?print($p)?>";
}
</script>
<body onload="setTimeout('go()',3000);">
<?print($msg);?><br>
系统将在3秒钟以后自动返回。如果不能返回或者你着急,请按<a href=index.php?fl=<?print($fl_a);?>&p=<?print($p)?这里</a>
</body>
MYSQL数据库:yxforum
+-------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+----------------+
| id | int(11) | | PRI | 0 | auto_increment |
| dt | datetime | YES | | NULL | |
| tp | varchar(255) | YES | | NULL | |
| ct | text | YES | | NULL | |
| fl | int(11) | YES | | NULL | |
| ip | varchar(20) | YES | | NULL | |
| un | varchar(50) | YES | | NULL | |
| em | varchar(60) | YES | | NULL | |
| num | int(11) | YES | | NULL | |
+-------+--------------+------+-----+---------+----------------+
index.php:
<html>
<head>
<style type="text/css">
<!--
.unnamed1 { font-size: 9pt; font-family: "宋体"}
.unnamed1 A {COLOR: #000088; FONT-SIZE: 9pt; TEXT-DECORATION: none; TEXT-TRANSFORM: none; font-family: "宋体"}
.unnamed1 A:hover {COLOR: #880000; FONT-SIZE: 9pt; TEXT-DECORATION: underline overline; font-family: "楷体_GB2312"}
.unnamed2 { font-size: 12px; color: #9933FF}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#000066" vlink="#0000CC" alink="#000099">
<?$m=mysql_connect("localhost","××××","××××");
mysql_select_db("××××",$m);
?>
<?if ($fl=="") $fl=1;
$hf_fl=$fl;
$q="select * from yxforum where id=".$fl;
$mr=mysql_query($q,$m);
$ra=mysql_fetch_row($mr);
?>
<p align=center><b><?print($ra[2]);?></b><br>
<?if ($fl!=1) {
?>
<small><?printf("(<a href=mailto:%s>%s</a>) ",$ra[7],$ra[6]);?>
</small></p>
<?$alltt=$ra[2];
$lastid=$ra[4];
print("<center><table width=90% border=1><tr><td bgcolor=#dddddd class=unnamed1>".$ra[3]."</tr></table></center>");
print("<br><small>跟随主题:</small>");
}
$q="select * from yxforum where fl=".$fl." order by dt desc";
if ($p=="") $p=0;
$mr=mysql_query($q,$m);
$f=mysql_num_fields($mr);
$ra=mysql_fetch_row($mr);
$i=0; $p1=$p*15; /*跳过指定的页数对应的行*/
while ($i<$p1)
{$i++;
$ra=mysql_fetch_row($mr);
if (! $ra) break;}
?>
<center>
<table border=0 width=732 class="unnamed1">
<tr align="center" valign="top" bgcolor="#FFFFCC">
<td width="186" >最新回应时间
<td width="88">发表人
<td width="414">主题
<td width="44">回应数
</tr>
<?
$x[0]="ffffcc";$x[1]="DEEFFF";$i=1;
while ($ra) /*显示目前的主题*/
{$ys_c=$i%2;
print("<tr height=12 bgcolor=#".$x[$ys_c]."><td align=center>".$ra[1]);
print("<td align=center><a href=mailto:".$ra[7].">".$ra[6]."</a>");
print("<td>");
printf("<a href=index.php?fl=%s>%s</a>",$ra[0],$ra[2]);
print("<td align=center>".$ra[8]);
print("</tr>");
$ra=mysql_fetch_row($mr);
$i++;
if ($i>15) break;
}
?>
</table></center>
<form action=index.php method=get name=F0 onsubmit="document.F0.p.value--;return true;">
<span class=unnamed1>
<?
$alllines=mysql_affected_rows($m);
$pages=$alllines/15;
if ($pages-intval($pages)!=0) $pages=intval($pages)+1;
else $pages=intval($pages);
print("共".$pages."页 第".($p+1)."页 ");
if ($p>0) {printf("<a href=index.php?fl=%s>首页</a> ",$hf_fl);
printf("<a href=index.php?fl=%s&p=%d>上一页</a> ",$hf_fl,$p-1);}
if ($ra) {printf("<a href=index.php?fl=%s&p=%d>下一页</a> ",$hf_fl,$p+1);
printf("<a href=index.php?fl=%s&p=%d>末页</a> ",$hf_fl,$pages-1);}
?>指定第<input type=text size=2 name=p>页
</span>
<span class=unnamed1>
<?if ($hf_fl!=1) {printf("<br><a href=index.php?fl=%s>上一级</a> ",$lastid);
print("<a href=index.php>最高级</a><br>");}
?>
</form><center>
<table width=80% bgcolor=#eeeeff><tr><td class=unnamed1>
<?print(($fl==1)?"加新贴:":"回应:");?>
<form action="addnew.php" method=post name="F1">
姓名:
<input type="text" name="nm" size="15">
<br>
Email:
<input type="text" name="em" size="45">
<br>
标题(必填):
<input type="text" name="tt" size="45" <?if ($fl!=1) print("value=回复:".$alltt);?> >
<input type=hidden name="fl" value="<?print($hf_fl);?>">
<input type=hidden name="p" value="<?print($p);?>">
<br>
正文(必填): <br>
<textarea name="zw" cols="50" rows="10"></textarea>
<input type="submit" name="Submit" value="提 交">
</form>
</tr></table></center>
<hr>
<center>自用论坛程序0.25版 设计工具:PHP+MYSQL<br>
<a href=mailto:fhl@cgi.hnpts.ha.cn>古钺青剑</a> 制作<br><a href=http://www.fhlfox.dhs.org>逍遥飞狐多媒体作坊</a> 2000 </center>
</span>
</body>
</html>
addnew.php:
<?$m=mysql_connect("localhost","×××","×××××");
mysql_select_db("×××××",$m);
$zw=ereg_replace("<","<",$zw);
$zw=ereg_replace(">",">",$zw);
$zw=ereg_replace("n","<br>",$zw);
$zw=ereg_replace(" "," ",$zw);
$tt=ereg_replace("<","<",$tt);
$tt=ereg_replace(">",">",$tt);
if ($nm=="") $nm="无名宝";
if ($em=="") {$nm.="<-- 是一只没有MAIL的菜鸟";$em="No";}
$err=strlen($tt)*strlen($zw);
if ($err==0)
$msg="<font color=red>不要偷懒嘛!把表格填完再提交不迟。</font>";
else {$q="insert into yxforum (dt,tp,ct,fl,ip,un,em,num) values"
."(now(),"".$tt."","".$zw."",".$fl.","".$REMOTE_ADDR."","".$nm."","".$em."",0)";
mysql_query($q,$m);
$q="select num,fl from yxforum where id=".$fl;
$fl_a=$fl;
do { $mr=mysql_query($q,$m);
$ra=mysql_fetch_row($mr);
$num=$ra[0]+1;
$q="update yxforum set dt=now(),num=".$num." where id=".$fl;
$fl=$ra[1];
mysql_query($q,$m);
$q="select num,fl from yxforum where id=".$fl;
} while ($fl>0);
$msg="<font color=green>你的意见已经成功提交!</font>";
}
?>
<html>
<head>
<script language="Javascript">
function go()
{document.location="index.php?fl=<?print($fl_a);?>&p=<?print($p)?>";
}
</script>
<body onload="setTimeout('go()',3000);">
<?print($msg);?><br>
系统将在3秒钟以后自动返回。如果不能返回或者你着急,请按<a href=index.php?fl=<?print($fl_a);?>&p=<?print($p)?这里</a>
</body>
无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com
暂无评论...
更新日志
2024年11月15日
2024年11月15日
- 群星《2024好听新歌14》十倍音质 U盘音乐 [WAV分轨][966M]
- s14全球总决赛T1战队队员都有谁 LOLs14全球总决赛T1战队介绍
- 英雄联盟faker身价有10亿吗 英雄联盟faker身价介绍一览
- faker大魔王称号怎么来的 faker大魔王称号来源介绍
- PS5 Pro上的蒂法更美了!博主盛赞新机1000%值得购买
- 腾讯互娱再离职一员大将!或因供应商贪腐
- Ayaneo3游戏掌机预热:旗舰定位、造型圆润自带底键
- 动力火车.1999-背叛情歌【上华】【WAV+CUE】
- 刘力扬.2019-Neon.Lit虹【摩登天空】【FLAC分轨】
- 群星.2002-恋爱物语情歌对唱精选2CD(引进版)【滚石】【WAV+CUE】
- 群星《闽南情24K德国HD金碟》2CD[WAV+CUE]
- 周传雄《恋人创世纪》环球唱片[WAV+CUE]
- 关淑怡-《真假情话K2HD》(日本压制)【WAV+CUE】
- 王菲 -《Faye Wong》雨果LPCD45 [WAV+分轨][1G]
- 陈百强《世纪10星·永恒篇》环球[WAV+CUE][1G]