PHP+DBM's Alumni Program (1)

Source: Internet
Author: User
Tags header key modify reset
The program this alumni originally to our class use, because the server does not have MySQL support, chose dbm
There is no dbm program in China, and there is hardly any foreign
Spent a night, in the case of scarcely any reference to write out
Now publish it.
is a very good example of dbm usage

1, INDEX.PHP3
?
if ($login) {
?>
<HTML>
<HEAD>
<TITLE> Shenzhen Secondary 2000 High School (12) class alumni </TITLE>

<style type= "Text/css" >
A {text-decoration:none; color: #336699; font-family: "XXFarEastFont-font-size:9pt}";
a:hover {text-decoration:underline; color: #FF0000; font-family: "Song Body"; font-size:9pt}
Body {font-family: "XXFarEastFont-Arial", "Serif"; font-size:9pt}
TD {Font-family: "Song Body", "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, song body; 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> Shenzhen High School (12) class alumni </b><br>
<table border= "0" width= "80%" cellpadding= "2" cellspacing= "1" bgcolor= "#000000" align= "Center" >
<tr align=center>
&LT;TD width=19% bgcolor= "#336699" ><font color= "#FFFFFF" > Name </FONT></td>
&LT;TD width=17% bgcolor= "#336699" ><font color= "#FFFFFF" >NickName</font></td>
&LT;TD width=18% bgcolor= "#336699" ><font color= "#FFFFFF" >OICQ</FONT></td>
&LT;TD width=27% bgcolor= "#336699" ><font color= "#FFFFFF" > Mailing address </font></td>
&LT;TD width=19% bgcolor= "#336699" ><font color= "#FFFFFF" > Details </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 &GT;&LT;/TD&GT;&LT;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" > Click to view </a></td></tr> ";
$key = Dbmnextkey ($dbm, $key);
}
?>
<tr bgcolor= "#336699" align= "Center" >
&LT;TD colspan= "5" ><font color= #FFFFFF ><a href= "modify.php3" ><font color= #FFFFFF > Modify Information </ font></a>| | <a href= "changepwd.php3" ><font color= #FFFFFF > Modify Password </font></a>| | <a href= "logout.php3" ><font color= #FFFFFF > click Exit </font></a></font></td>
</tr>
</table>
<p align= "Center" > EX Alumni v1.0 version? Program production: <a href= "Mailto:y10k@963.net" >y10k</a><br>
Welcome visit: <a href= "http://www.best4cn.com" target= "_blank" >http://www.best4cn.com</a> </p>
</body>?
}else header ("location:login.php3");
?>

2, change the password changepwd.php3
?
Require ("common.php3");
if ($submit) {
$id = $login;
if ($id ==false) error ("Please change password after landing");
else{
$data =dbmopen ("Password", "w");
$pass =dbmfetch ($data, $login);
if ($password = = $pass) {
if ($password 2== $password 1) {
Dbmreplace ($data, $id, $password 2);
Header ("location:index.php3");
}else error ("The password you typed two times is different!") ");
}else error ("Sorry, you entered the original password error, can not modify the password!" ");
}
}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><body bgcolor= #ffffff >
<form action=changepwd.php3 method=post>
<CENTER>
<table bgcolor= #000000 border=0 cellspacing=1>
<TBODY>
<tr align=middle>
&LT;TD align=middle bgcolor= #336699 Colspan=4><font
color= #ffffff > User Change Password </FONT></TD>
</TR>
<tr align=middle>
&LT;TD align=middle bgcolor= #f7f7f7 width= "122" >
<p align=center> Old Password </P>
</TD>
&LT;TD align=middle bgcolor= #f7f7f7 colspan= "3" width= "205" >
<input
Class=stedit name=password>
</TD>
</TR>
<tr align=middle>
&LT;TD align=middle bgcolor= #f7f7f7 width= "122" >
<p align=center> New Password </p>
</td>
&LT;TD align=middle bgcolor= #f7f7f7 colspan= "3" width= "205" >
<input
Class=stedit name=password1>
</td>
</tr>
<tr align=middle>
&LT;TD align=middle bgcolor= #f7f7f7 width= "122" >
<p align=center> Duplicate Password </p>
</td>
&LT;TD align=middle bgcolor= #f7f7f7 colspan= "3" width= "205" >
<input
Class=stedit name=password2>
</td>
</tr>
<tr align=middle>
&LT;TD align=middle bgcolor= #f7f7f7 colspan=4>
<div align=center>
<P>
<input CLASS=STBTM name=submit type=submit value= Confirm modification >

<input CLASS=STBTM Type=reset value= re-modify name= "Reset" >
</P>
</DIV>
</TD>
</TR>
</TBODY>
</TABLE>
</CENTER></FORM></BODY></HTML>
?
}
?>


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.