PHP+DBM的同学录程序(2)

3、删除成员del.php3

$adminpass)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.php3
  1<html><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
  2<link href="style.css" rel="stylesheet"/><title>同学录 出错</title></head><body bgcolor="#ffffff">
  3<html><head></head><body bgcolor="#FFFFFF"><center><table border="0" cellpadding="0" cellspacing="0" height="80%" width="80%">
  4<tr><td width="100%"><table bgcolor="#000000" border="0" cellpadding="0" cellspacing="0" width="100%">
  5<tr><td width="100%"><table align="left" border="0" cellspacing="1" height="320" width="100%">
  6<tr><td align="center" bgcolor="#FFB500" height="31" width="100%"><font color="#804000"><span style="font-size: 11pt">同学录 出错</span></font></td>
  7</tr><tr><td align="left" bgcolor="#F7F7F7" height="247" width="100%"><span style="font-size: 11pt"><p align="center">   
  8出错原因:<font color="#FF0000"><? echo $msg;?></font></p><p align="center"><a href="javascript:history.go(-1);"><font color="#000000">请点这里返回上一页检查你的输入是否有误</font></a></p>
  9<p align="center">[ <a href="javascript:history.go(-1);">返回上一页</a> ]</p></span></td></tr><tr><td bgcolor="#FFB500" height="30" width="100%"><p align="right"><span style="font-size: 9pt"><font color="#804000">Copyright 200x y10k </font><font color="#804000" face="Arial">.Allrights reserved.</font></span></p></td>
 10</tr></table></td></tr></table></td></tr></table></center></body></html>
 11<?   
 12}   
 13?>   
 14  
 155、登陆文件login.php3   
 16<?   
 17require("common.php3");   
 18if($submit){   
 19$id=chop($id);   
 20if($id=="")error("请输入您的用户名称!");   
 21else{   
 22$dbm=dbmopen("password","r");   
 23if(!dbmexists($dbm,$id))error("没有这个用户名称!");   
 24else{   
 25$pass=dbmfetch($dbm,$id);   
 26if($pass==$password){   
 27setcookie("login",$id,time()+31536000);   
 28header("location:index.php3");   
 29}else error("您的密码不对!如果忘记密码,请使用忘记密码功能!");   
 30}   
 31dbmclose($dbm);   
 32}   
 33}else{   
 34?>
 35<html>
 36<head>
 37<title>深圳中学2000届高中(12)班同学录:::版权所有:辛湜@深圳中学2000届高中(12)班</title>
 38<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
 39<style type="text/css">   
 40<!--   
 41body {background: buttonface; border: 0;}   
 42#titleBar {text-align: left;   
 43width: 300;   
 44height: 20px;   
 45border: 0px solid navy; background: navy; color: white; font-family: verdana; font-size: 12px;   
 46font-weight: bold;   
 47padding: 3;   
 48padding-left: 15;   
 49z-index: 2;}   
 50#box {width: 300;   
 51border: 15px solid navy; border-top: 0; background: white; color: black; font-family: verdana; font-size: 12px;   
 52padding: 5;   
 53z-index: 1;}   
 54table {width: 240; margin: 10px; margin-top: 20px;}   
 55td {color: black; font-family: verdana; font-size: 12px;}   
 56.textInput {background: white; color: black;   
 57width: 160px;   
 58border-top: 1px solid gray;   
 59border-left: 1px solid gray;   
 60border-right: 1px solid #eeeeee;   
 61border-bottom: 1px solid #eeeeee;   
 62}   
 63.button {font-family: verdana; font-size: 12px; background: navy; color: white; border-width: 1px;}   
 64.pos {width: 100%; height: 100%; text-align: center;}   
 65\-->   
 66</style>
 67</head>
 68<body bgcolor="#FFFFFF" scroll="no">
 69<table class="pos">
 70<tr>
 71<td>
 72<div id="titleBar">深圳中学2000届高中(12)班同学录</div>
 73<div id="box">
 74<form action="login.php3">
 75<table width="348">
 76<tr>
 77<td colspan="2"><label accesskey="u" for="userInp"><u>U</u>sername:</label>
 78<input class="textInput" id="userInp" name="id" type="text"/>
 79</td>
 80</tr>
 81<tr>
 82<td colspan="2"><label accesskey="p" for="pwdInp"><u>P</u>assword:</label>
 83<input class="textInput" id="pwdInp" name="password" type="password"/>
 84</td>
 85</tr>
 86<tr>
 87<td style="text-align: right">
 88<div align="left">&gt;&gt;<a href="forgetpwd.php3">忘记密码点击这里</a>&lt;&lt;</div>
 89</td>
 90<td style="text-align: right">
 91<input class="button" name="submit" type="submit" value="登陆"/>   
 92     
 93<input class="button" name="button2" onclick="window.open('reg.php3')" type="button" value="注册"/>
 94</td>
 95</tr>
 96</table>
 97</form>
 98</div>
 99</td>
100</tr>
101</table>
102</body>
103</html>
104<?   
105}   
106?></body></html>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus