PHP+DBM's Alumni Program (2)
Last Update:2017-02-28
Source: Internet
Author: User
Program 3, delete member Del.php3
?
Require ("common.php3");
$id =chop ($id);
if (!isset ($id)) error ("Please enter the user ID to be deleted!") ");
ElseIf ($pwd <> $adminpass) error ("Admin password Error! ");
else{
$data =dbmopen ("Class", "W");
Dbmdelete ($data, $id);
Dbmclose ($data);
$data =dbmopen ("Password", "w");
Dbmdelete ($data, $id);
Dbmclose ($data);
Header ("location:index.php3");
}
?>
4. Common file Common.php3
?
$adminpass = "Test";
Function error ($MSG) {
?>
<link rel= "stylesheet" href= "STYLE.CSS" ><title> Alumni error </title><TR><TD width= "100%" ><table border= "0" width= "100%" bgcolor= "#000000" cellspacing= "0" cellpadding= "0" >
<TR><TD width= "100%" ><table border= "0" cellspacing= "1" width= "100%" Align=left "height=" >
<TR><TD width= "100%" bgcolor= "#FFB500" Align=center height= "to" ><font color= "#804000" ><span style= "FONT-SIZE:11PT" > Alumni error </span></font></td>
</TR><TR><TD width= "100% align=left height=" 247 "bgcolor=" #F7F7F7 "><span style=" font-size: 11pt "><p align=" center >
Cause of error: <font color= "#FF0000" ><? Echo $msg;? ></font></p><p align= "center" ><a href= "Javascript:history.go (-1);" ><font color= "#000000" > Please click here to return to the previous page to check if your input is incorrect </font></a></p>
<p align= "center" >[<a href= "Javascript:history.go (-1);" > Back to Previous page </a>]</p></span></td></tr><tr><td width= "100%" bgcolor= "#FFB500" height= "><p" align= "right" ><span
Style= "font-size:9pt" ><font color= "#804000" >copyright 200x y10k </font><font face= "Arial" color= "# 804000 "". Allrights reserved.</font></span></td>
</tr></table></td></tr></table></td></tr></table></center ></body>?
}
?>
5, landing documents LOGIN.PHP3
?
Require ("common.php3");
if ($submit) {
$id =chop ($id);
if ($id = = "") Error ("Please enter your user name!") ");
else{
$DBM =dbmopen ("password", "R");
if (!dbmexists ($DBM, $id)) error ("No such user name!") ");
else{
$pass =dbmfetch ($dbm, $id);
if ($pass = = $password) {
Setcookie ("Login", $id, Time () +31536000);
Header ("location:index.php3");
}else error ("Your password is wrong!") If you forget your password, use the Forgotten password feature! ");
}
Dbmclose ($DBM);
}
}else{
?>
<title> Shenzhen Middle School 2000 Senior High School (12) class Alumni::: Xin? @ Shenzhen Middle School 2000 Senior High School (12) class </title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<style type= "Text/css" >
<!--
body {background:buttonface; border:0;}
#titleBar {text-align:left;
width:300;
height:20px;
border:0px Solid Navy; Background:navy; Color:white; Font-family:verdana; font-size:12px;
Font-weight:bold;
Padding:3;
padding-left:15;
Z-index:2;}
#box {width:300;
BORDER:15PX Solid Navy; border-top:0; Background:white; Color:black; Font-family:verdana; font-size:12px;
Padding:5;
Z-index:1;}
Table {width:240; margin:10px; margin-top:20px;}
TD {Color:black; font-family:verdana; font-size:12px;}
. textInput {background:white; color:black;
width:160px;
border-top:1px solid Gray;
border-left:1px solid Gray;
border-right:1px solid #eeeeee;
border-bottom:1px solid #eeeeee;
}
. button {Font-family:verdana; font-size:12px; background:navy; color:white; border-width:1px;}
. pos {width:100%; height:100%; text-align:center;}
-->
</style>
<body bgcolor= "#FFFFFF" scroll= "no" >
<table class= "POS" >
<tr>
<td>
<div id= "titlebar" > Shenzhen Secondary School (12) class alumni </div>
<div id= "box" >
<form action= "Login.php3" >
<table width= "348" >
<tr>
<TD colspan= "2" ><label for= "USERINP" accesskey= "U" ><u>U</u>sername:</label>
<input type= "text" name= "id" class= "textInput" id= "USERINP" >
</td>
</tr>
<tr>
<TD colspan= "2" ><label for= "Pwdinp" accesskey= "P" ><u>P</u>assword:</label>
<input type= "password" name= "password" class= "TextInput" id= "PWDINP" >
</td>
</tr>
<tr>
<TD style= "Text-align:right" >
<div align= "left" >>><a href= "forgetpwd.php3" > Forgot password click here </a><<</div>
</td>
<TD style= "Text-align:right" >
<input type= "Submit" value= "Landing" class= "button" Name= "Submit" >
<input type= "button" value= "registered" class= "button" onclick= "window.open (' reg.php3 ')" Name= "Button2" >
</td>
</tr>
</table>
</form>
</div>
</td>
</tr>
</table>
</body>
?
}
?>