当前位置: 首页 > 图文教程 > 网络编程 > PHP > PHP+DBM的同学录程序(2)

PHP
PHP中上传大体积文件时需要的设置
用PHP生成PDF文件 with FPDF
在同一窗体中使用PHP来处理多个提交任务
PHP经验交流:php访问access的方法
PHP实用手册:PHP常用正则表达式收集
也用PHP来实现网页静态发布的两种方法
PHP使用zlib扩展实现页面GZIP压缩输出
PHP的语言层面的优化以及代码优化技巧
PHP实例:上传多个图片并校验的代码
用php+odbc+access数据库来操作函数
用PHP来实现页面GZIP的压缩输出教程
PHP进阶技巧:php用流方式制作缩略图
使用php 5时MySQL返回乱码的解决办法
新手如何使用PHP来创建RSS的阅读器
PHP实用:用PHP来实现图片的简单上传
利用php和js来轻松实现页面数据的刷新
在PHP中使用随机数的三个步骤详细代码
PHP进阶技巧:如何避免表单的重复提交
PHP技术进阶 PHP SOCKET 技术研究
PHP技术进阶:php用流方式制作缩略图

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 46 ::
收藏到网摘: n/a

3、删除成员del.php3
<?
require("common.php3");
$id=chop($id);
if(!isset($id))error("请输入要删除的用户ID !");
elseif($pwd<>$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
<?
$adminpass="test";
function error($msg){
?>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="style.css"><title>同学录 出错</title></head><body bgcolor="#ffffff">
<html><head></head><body bgcolor="#FFFFFF"><center><table border="0" width="80%" height="80%" cellspacing="0" cellpadding="0">
<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="320">
<tr><td width="100%" bgcolor="#FFB500" align=center height="31"><font color="#804000"><span style="font-size: 11pt">同学录 出错</span></font></td>
</tr><tr><td width="100%" align=left height="247" bgcolor="#F7F7F7"><span style="font-size: 11pt"><p align="center">
出错原因:<font color="#FF0000"><? echo $msg;?></font></p><p align="center"><a href="javascript:history.go(-1);"><font color="#000000">请点这里返回上一页检查你的输入是否有误</font></a></p>
<p align="center">[ <a href="javascript:history.go(-1);">返回上一页</a> ]</p></span></td></tr><tr><td width="100%" bgcolor="#FFB500" height="30"><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></html>
<?
}
?>
5、登陆文件login.php3
<?
require("common.php3");
if($submit){
$id=chop($id);
if($id=="")error("请输入您的用户名称!");
else{
$dbm=dbmopen("password","r");
if(!dbmexists($dbm,$id))error("没有这个用户名称!");
else{
$pass=dbmfetch($dbm,$id);
if($pass==$password){
setcookie("login",$id,time()+31536000);
header("location:index.php3");
}else error("您的密码不对!如果忘记密码,请使用忘记密码功能!");
}
dbmclose($dbm);
}
}else{
?>
<html>
<head>
<title>深圳中学2000届高中(12)班同学录:::版权所有:辛湜@深圳中学2000届高中(12)班</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>
</head>
<body bgcolor="#FFFFFF" scroll="no">
<table class="pos">
<tr>
<td>
<div id="titleBar">深圳中学2000届高中(12)班同学录</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">忘记密码点击这里</a><<</div>
</td>
<td style="text-align: right">
<input type="submit" value="登陆" class="button" name="submit">

<input type="button" value="注册" class="button" onClick="window.open('reg.php3')" name="button2">
</td>
</tr>
</table>
</form>
</div>
</td>
</tr>
</table>
</body>
</html>
<?
}
?>