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


Posted in PHP onOctober 09, 2006

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>
<?
}
?> 

PHP 相关文章推荐
xml+php动态载入与分页
Oct 09 PHP
一篇不错的PHP基础学习笔记
Mar 18 PHP
黑夜路人出的几道php笔试题
Aug 04 PHP
PHP中3种生成XML文件方法的速度效率比较
Oct 06 PHP
curl不使用文件存取cookie php使用curl获取cookie示例
Jan 26 PHP
php使用mkdir创建多级目录入门例子
May 10 PHP
PHP采用curl模仿用户登陆新浪微博发微博的方法
Nov 07 PHP
用PHP代码在网页上生成图片
Jul 01 PHP
php for 循环使用的简单实例
Jun 02 PHP
php基于闭包实现函数的自调用(递归)实例分析
Nov 11 PHP
Zend Framework动作控制器用法示例
Dec 09 PHP
PHP设计模式入门之状态模式原理与实现方法分析
Apr 26 PHP
基于mysql的bbs设计(一)
Oct 09 #PHP
基于mysql的bbs设计(二)
Oct 09 #PHP
基于mysql的bbs设计(三)
Oct 09 #PHP
支持oicq头像的留言簿(一)
Oct 09 #PHP
NT IIS下用ODBC连接数据库
Oct 09 #PHP
怎样在UNIX系统下安装php3
Oct 09 #PHP
怎样在UNIX系统下安装MySQL
Oct 09 #PHP
You might like
8个出色的WordPress SEO插件收集
2011/02/26 PHP
mysql_num_rows VS COUNT 效率问题分析
2011/04/23 PHP
PHP中如何定义和使用常量
2013/02/28 PHP
JAVASCRIPT  THIS详解 面向对象
2009/03/25 Javascript
jQuery 美元符冲突的解决方法
2010/03/28 Javascript
可插入图片的TEXT文本框
2013/12/27 Javascript
js仿百度贴吧验证码特效实例代码
2014/01/16 Javascript
基于jquery和svg实现超炫酷的动画特效
2014/12/09 Javascript
javascript中scrollTop详解
2015/04/13 Javascript
jQuery实现输入框下拉列表树插件特效代码分享
2015/08/27 Javascript
深入浅析JavaScript面向对象和原型函数
2016/02/06 Javascript
jquery拖拽排序简单实现方法(效果增强版)
2016/02/16 Javascript
不同js异步函数同步的实现方法
2016/05/28 Javascript
js利用正则表达式检验输入内容是否为网址
2016/07/05 Javascript
JavaScript数组迭代方法
2017/03/03 Javascript
使用Bootstrap打造特色进度条效果
2017/05/02 Javascript
在小程序中使用腾讯视频插件播放教程视频的方法
2018/07/10 Javascript
浅谈Vue 自动化部署打包上线
2020/06/14 Javascript
Python中的默认参数详解
2015/06/24 Python
使用Python的PIL模块来进行图片对比
2016/02/18 Python
python3 map函数和filter函数详解
2019/08/26 Python
Python return语句如何实现结果返回调用
2020/10/15 Python
详解HTML5新增标签
2017/11/27 HTML / CSS
为你的html5网页添加音效示例
2014/04/03 HTML / CSS
Sneaker Studio乌克兰:购买运动鞋
2018/03/26 全球购物
波兰在线杂货店:Polski Koszyk
2019/11/02 全球购物
服务生自我鉴定
2014/01/22 职场文书
软件毕业生个人鉴定
2014/03/03 职场文书
出纳员岗位职责风险
2014/03/06 职场文书
房屋买卖委托公证书
2014/04/08 职场文书
大学毕业寄语大全
2014/04/10 职场文书
贸易跟单员英文求职信
2014/04/19 职场文书
试用期自我评价范文
2015/03/10 职场文书
个人求职意向书
2015/05/11 职场文书
四风之害观后感
2015/06/09 职场文书
Python多个MP4合成视频的实现方法
2021/07/16 Python