这个同学录原来给我们班级用的,因为服务器没有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 colspan="5"><font color=#FFFFFF><a href="modify.php3"><font color=#FFFFFF>修改资料</font></a>||<a href="changepwd.php3"><font color=#FFFFFF>修改密码</font></a>||<a href="logout.php3"><font color=#FFFFFF>点击退出</font></a></font></td>
  </tr>
</table>
<p align="center"> Ex同学录v1.0版本程序制作:<a href="mailto:y10k@963.net">y10k</a><br>
  欢迎访问:<a href="http://www.best4cn.com" target="_blank">http://www.best4cn.com</a> </p>
</body></html>
<?
}else header("location:login.php3");
?>

2、更改密码的changepwd.php3
<?
require("common.php3");
if($submit){
$id=$login;
if($id==false)error("请登陆后再修改密码");
else{
  $data=dbmopen("password","w");
  $pass=dbmfetch($data,$login);
  if($password==$pass){
    if($password2==$password1){
      dbmreplace($data,$id,$password2);
      header("location:index.php3");
    }else error("您两次输入的密码不一样啊!");
  }else error("对不起,您输入的原来的密码错误,不能修改密码!");
}
}else{
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=gb2312" http-equiv=Content-Type><LINK  
href="style.css" rel=stylesheet>
<META content="MSHTML 5.00.2614.3500" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff>
<FORM action=changepwd.php3 method=post>
<CENTER>
    <TABLE bgColor=#000000 border=0 cellSpacing=1>
      <TBODY>  
      <TR align=middle>  
        <TD align=middle bgColor=#336699 colSpan=4><FONT  
      color=#ffffff>用户修改密码</FONT></TD>
      </TR>
      <TR align=middle>  
        <TD align=middle bgColor=#f7f7f7 width="122">  
          <P align=center>老的密码</P>
        </TD>
        <TD align=middle bgColor=#f7f7f7 colspan="3" width="205">&nbsp;&nbsp;&nbsp;  
          <INPUT  
      class=stedit name=password>
        </TD>
      </TR>
      <tr align=middle>  
        <td align=middle bgcolor=#f7f7f7 width="122">  
          <p align=center>新的密码</p>
        </td>
        <td align=middle bgcolor=#f7f7f7 colspan="3" width="205">&nbsp;&nbsp;&nbsp;  
          <input  
      class=stedit name=password1>
        </td>
      </tr>
      <tr align=middle>  
        <td align=middle bgcolor=#f7f7f7 width="122">  
          <p align=center>重复密码</p>
        </td>
        <td align=middle bgcolor=#f7f7f7 colspan="3" width="205">&nbsp;&nbsp;&nbsp;  
          <input  
      class=stedit name=password2>
        </td>
      </tr>
      <TR align=middle>  
        <TD align=middle bgColor=#f7f7f7 colSpan=4>  
          <DIV align=center>  
            <P>  
              <INPUT class=stbtm name=submit type=submit value=确认修改>
              &nbsp;&nbsp;&nbsp;  
              <INPUT class=stbtm type=reset value=重新修改 name="reset">
            </P>
          </DIV>
        </TD>
      </TR>
      </TBODY>  
    </TABLE>
  </CENTER></FORM></BODY></HTML>
<?
}
?>
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!