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 相关文章推荐
phpmyadmin中配置文件现在需要绝密的短语密码的解决方法
Feb 11 PHP
用php+javascript实现二级级联菜单的制作
May 06 PHP
JpGraph php柱状图使用介绍
Aug 23 PHP
PHP时间戳与日期之间转换的实例介绍
Apr 19 PHP
php输入流php://input使用浅析
Sep 02 PHP
PHP中的traits实现代码复用使用实例
May 13 PHP
PHP引用的调用方法分析
Apr 25 PHP
mysql_escape_string()函数用法分析
Apr 25 PHP
浅谈PHP链表数据结构(单链表)
Jun 08 PHP
PHP随机获取未被微信屏蔽的域名(微信域名检测)
Mar 19 PHP
完美解决在ThinkPHP控制器中命名空间的问题
May 05 PHP
三个思路解决laravel上传文件报错:413 Request Entity Too Large问题
Nov 13 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生成的html meta和link标记在body标签里 顶部有个空行
2010/05/18 PHP
php学习笔记之面向对象
2014/11/08 PHP
CI框架数据库查询缓存优化的方法
2016/11/21 PHP
php lcg_value与mt_rand生成0~1随机小数的效果对比分析
2017/04/05 PHP
PHP单文件上传原理及上传函数的封装操作示例
2019/09/02 PHP
js修改input的type属性及浏览器兼容问题探讨与解决
2013/01/23 Javascript
jquery实现图片灯箱明暗的遮罩效果
2013/11/15 Javascript
页面加载完毕后滚动条自动滚动一定位置
2014/02/20 Javascript
ES6中Generator与异步操作实例分析
2017/03/31 Javascript
基于jQuery实现瀑布流页面
2017/04/11 jQuery
javascript 中模板方法单例的实现方法
2017/10/17 Javascript
微信小程序实现美团菜单
2018/06/06 Javascript
layui table 参数设置方法
2018/08/14 Javascript
详解Element 指令clickoutside源码分析
2019/02/15 Javascript
js通过canvas生成图片缩略图
2020/10/02 Javascript
VUE异步更新DOM - 用$nextTick解决DOM视图的问题
2020/11/06 Javascript
使用jquery实现轮播图效果
2021/01/02 jQuery
[01:08]2014DOTA2展望TI 剑指西雅图LGD战队专访
2014/06/30 DOTA
python搭建简易服务器分析与实现
2012/12/15 Python
使用Python编写简单网络爬虫抓取视频下载资源
2014/11/04 Python
分享python数据统计的一些小技巧
2016/07/21 Python
利用Python如何批量修改数据库执行Sql文件
2018/07/29 Python
python存储16bit和32bit图像的实例
2018/12/05 Python
python导入pandas具体步骤方法
2019/06/23 Python
Python requests模块安装及使用教程图解
2020/06/30 Python
美国网上鞋子零售商:Dr. Scholl’s Shoes
2017/11/17 全球购物
卡拉威高尔夫官方网站:Callaway Golf
2020/09/16 全球购物
C和C++经典笔试题附答案解析
2014/08/18 面试题
应届生法律求职信
2013/10/22 职场文书
浙大毕业生自荐信
2014/01/26 职场文书
优秀经理事迹材料
2014/02/01 职场文书
团购业务员岗位职责
2014/03/15 职场文书
文明礼貌演讲稿
2014/05/12 职场文书
法律专业大学生职业生涯规划书:向目标一步步迈进
2014/09/22 职场文书
学校食堂标语
2014/10/06 职场文书
红色电影观后感
2015/06/18 职场文书