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 相关文章推荐
PHP面向对象编程快速入门
Dec 14 PHP
MySql 按时间段查询数据方法(实例说明)
Nov 02 PHP
PHP 配置open_basedir 让各虚拟站点独立运行
Nov 12 PHP
php制作unicode解码工具(unicode编码转换器)代码分享
Dec 24 PHP
php使用cookie保存用户登录的用户名实例
Jan 26 PHP
[原创]PHP实现逐行删除文件右侧空格的方法
Dec 25 PHP
Yii2增加验证码步骤详解
Apr 25 PHP
php将print_r处理后的数据还原为原始数组的解决方法
Nov 02 PHP
php Session无效分析资料整理
Nov 29 PHP
PHP简单实现遍历目录下特定文件的方法小结
May 22 PHP
PHP实现的curl批量请求操作示例
Jun 06 PHP
Yii框架核心组件类实例详解
Aug 06 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
php 中include()与require()的对比
2006/10/09 PHP
PHP文件缓存内容保存格式实例分析
2014/08/20 PHP
PHP实现的sqlite数据库连接类
2014/12/12 PHP
javaScript矢量图表库-gRaphael几行代码实现精美的条形图/饼图/点图/曲线图
2013/01/09 Javascript
js如何取消事件冒泡
2013/09/23 Javascript
javascript ajax的5种状态介绍
2014/08/18 Javascript
利用jquery操作Radio方法小结
2014/10/20 Javascript
jQuery检测鼠标左键和右键点击的方法
2015/03/17 Javascript
javascript+html5实现仿flash滚动播放图片的方法
2015/04/27 Javascript
JS实现刷新父页面不弹出提示框的方法
2016/06/22 Javascript
jQuery回到顶部的代码
2016/07/09 Javascript
Angularjs自定义指令Directive详解
2017/05/27 Javascript
JavaScript实现的可变动态数字键盘控件方式实例代码
2017/07/15 Javascript
VueAwesomeSwiper在VUE中的使用以及遇到的一些问题
2018/01/11 Javascript
angular2实现统一的http请求头方法
2018/08/13 Javascript
在Python中使用M2Crypto模块实现AES加密的教程
2015/04/08 Python
Python3指定路径寻找符合匹配模式文件
2015/05/22 Python
Python中的条件判断语句基础学习教程
2016/02/07 Python
总结Python编程中函数的使用要点
2016/03/20 Python
使用python生成目录树
2018/03/29 Python
Python实现读取txt文件并转换为excel的方法示例
2018/05/17 Python
Python爬虫之正则表达式基本用法实例分析
2018/08/08 Python
Python3爬取英雄联盟英雄皮肤大图实例代码
2018/11/14 Python
Django 过滤器汇总及自定义过滤器使用详解
2019/07/19 Python
python脚本使用阿里云slb对恶意攻击进行封堵的实现
2021/02/04 Python
phpquery中文手册
2021/03/18 PHP
英国玛莎百货澳大利亚:Marks & Spencer Australia
2019/08/30 全球购物
英国第一职业高尔夫商店:Clickgolf.co.uk
2020/11/18 全球购物
C#的几个面试问题
2016/05/22 面试题
质检员岗位职责
2013/12/17 职场文书
个人自我剖析材料
2014/09/30 职场文书
离职信范文
2015/06/23 职场文书
学习心得体会
2019/06/20 职场文书
Python max函数中key的用法及原理解析
2021/06/26 Python
MySQL索引是啥?不懂就问
2021/07/21 MySQL
Echarts如何重新渲染实例详解
2022/05/30 Javascript