日期:2014-03-27  浏览次数:20529 次

这个同学录原来给我们班级用的,因为服务器没有mysql支持,就选择了dbm
国内还没有什么dbm程序,国外也几乎没有
花了一个晚上,在几乎没有任何参考的情况下写了出来
现在公布出来
是一个非常好的dbm使用范例

1、index.php3
<?
if($login){
?>
<HTML>
<HEAD>
<TITLE>深圳中学2000届高中(12)班同学录</TITLE>

<style type="text/css">
A {text-decoration: none; color: #336699; font-family: "宋体"; font-size: 9pt}
A:hover {text-decoration: underline; color: #FF0000; font-family: "宋体"; font-size: 9pt}
body {font-family: "宋体", "serif"; font-size: 9pt}
td {font-family: "宋体", "serif"; font-size: 9pt}
input {font-size: 9pt}
p {font-size: 9pt}
br {font-size: 9pt}
tr {font-size: 9pt}
table {font-size: 9pt}
INPUT { FONT-FAMILY: arial,宋体; FONT-SIZE: 9pt; PADDING-TOP: 3px }
INPUT.text {
BACKGROUND-COLOR: #f0f0f0; BORDER-BOTTOM: #101010 1px solid; BORDER-LEFT: #101010 1px solid; BORDER-RIGHT: #101010 1px solid; BORDER-TOP: #101010 1px solid; COLOR: #000000
}
INPUT.file {
BACKGROUND-COLOR: #f0f0f0; BORDER-BOTTOM: #101010 1px solid; BORDER-LEFT: #101010 1px solid; BORDER-RIGHT: #101010 1px solid; BORDER-TOP: #101010 1px solid; COLOR: #000000
}
SELECT {
BACKGROUND-COLOR: #f0f0f0; BORDER-BOTTOM: #101010 1px solid; BORDER-LEFT: #101010 1px solid; BORDER-RIGHT: #101010 1px solid; BORDER-TOP: #101010 1px solid; COLOR: #000000
}
TEXTAREA {
BACKGROUND-COLOR: #f0f0f0; BORDER-BOTTOM: #101010 1px solid; BORDER-LEFT: #101010 1px solid; BORDER-RIGHT: #101010 1px solid; BORDER-TOP: #101010 1px solid; COLOR: #000000
}
.stedit { font-size: 9pt; border-left: 1px solid #4a3163;
border-right: 1px solid #4a3163; border-top: 1px solid #4a3163;
border-bottom: 1px solid #000066 }
.stbtm { background-color: #cococo; color: #000000; font-size: 9pt; height: 20px;
border-left: 1px solid #ffffff; border-right: 1px solid #665b8e;
border-top: 1px solid #ffffff; border-bottom: 1px solid #665b8e }
.ddd {COLOR: #ffffff; FILTER: glow(color=black,strength=1); FONT-SIZE: 9pt; LINE-HEIGHT: 13pt; POSITION: relative; WIDTH: 100%}
</style>

</HEAD>
<body bgcolor="#FFFFFF">
<p class=pt10 align=center><b>深圳中学2000届高中(12)班同学录</b><br>
<table border="0" width="80%" cellpadding="2" cellspacing="1" bgcolor="#000000" align="center">
<tr align=center>
<td width=19% bgcolor="#336699"><font color="#FFFFFF">姓名</FONT></td>
<td width=17% bgcolor="#336699"><font color="#FFFFFF">NickName</font></td>
<td width=18% bgcolor="#336699"><font color="#FFFFFF">OICQ</FONT></td>
<td width=27% bgcolor="#336699"><font color="#FFFFFF">邮件地址</font></td>
<td width=19% bgcolor="#336699"><font color="#FFFFFF">详细信息</font></td>
</tr>
<?
$dbm=dbmopen("class","r");
$key = dbmfirstkey($dbm);
while ($key) {
$data=dbmfetch($dbm, $key);
$info=explode("|!:!|",$data);
echo "<tr BGCOLOR="#FFF5E1" align="center"><td width=19%><a href=show.php3?id=$key>$info[0]</a></td><td width=17%>$info[1]</td><td width=18%>$info[4]</td><td width=27%>$info[2]</td><td width=19%><a href="show.php3?id=$key">点击查看</a></td></tr>";
$key = dbmnextkey($dbm, $key);
}
?>
<tr BGCOLOR="#336699" align="center">
<td col