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初学者(入门学习经验谈)
Oct 12 PHP
求PHP数组最大值,最小值的代码
Oct 31 PHP
fetchAll()与mysql_fetch_array()的区别详解
Jun 05 PHP
PHP中mb_convert_encoding与iconv函数的深入解析
Jun 21 PHP
php接口与接口引用的深入解析
Aug 09 PHP
ASP和PHP实现生成网站快捷方式并下载到桌面的方法
May 08 PHP
PHP函数分享之curl方式取得数据、模拟登陆、POST数据
Jun 04 PHP
CI框架验证码CAPTCHA辅助函数用法实例
Nov 05 PHP
PHP使用SWOOLE扩展实现定时同步 MySQL 数据
Apr 09 PHP
PHP封装的完整分页类示例
Aug 21 PHP
PHP文件后缀不强制为.php方法
Mar 31 PHP
Centos7安装swoole扩展操作示例
Mar 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
用PHP生成静态HTML速度快类库
2007/03/18 PHP
ThinkPHP多语言支持与多模板支持概述
2014/08/22 PHP
php中删除数组的第一个元素和最后一个元素的函数
2015/03/07 PHP
php中实现可以返回多个值的函数实例
2015/03/21 PHP
浅谈PHP eval()函数定义和用法
2016/06/21 PHP
微信支付开发交易通知实例
2016/07/12 PHP
php利用ffmpeg提取视频中音频与视频画面的方法详解
2017/06/07 PHP
PHP基于XMLWriter操作xml的方法分析
2017/07/17 PHP
利用jquery的获取JS文件中的字符串内容
2012/02/14 Javascript
jquery 表格的增行删行实现思路
2013/03/21 Javascript
JQuery操作Select的Options的Bug(IE8兼容性视图模式)
2013/04/21 Javascript
JavaScript 数组详解
2013/10/10 Javascript
JavaScript程序员应该知道的45个实用技巧
2014/03/04 Javascript
JavaScript实现点击文本自动定位到下拉框选中操作
2016/06/15 Javascript
通过sails和阿里大于实现短信验证
2017/01/04 Javascript
AngularJS学习第一篇 AngularJS基础知识
2017/02/13 Javascript
解决vue单页面应用中动态修改title问题
2019/06/09 Javascript
[04:56]经典回顾:前Ehome 与 前LGD
2015/02/26 DOTA
Python实现返回数组中第i小元素的方法示例
2017/12/04 Python
Python使用cx_Oracle模块操作Oracle数据库详解
2018/05/07 Python
python实现多进程代码示例
2018/10/31 Python
python实现多进程通信实例分析
2019/09/01 Python
新西兰航空中国官网:Air New Zealand China
2018/07/24 全球购物
刚毕业大学生自荐信范文
2014/02/20 职场文书
学习雷锋寄语大全
2014/04/11 职场文书
教师对学生的评语
2014/04/28 职场文书
四风剖析查摆对照检查材料思想汇报
2014/09/24 职场文书
幼儿教师自我剖析材料
2014/09/29 职场文书
大学迎新生标语
2014/10/06 职场文书
群众路线党员个人整改措施
2014/10/27 职场文书
介绍信模板
2015/01/31 职场文书
英文商务邀请函范文
2015/01/31 职场文书
学校艾滋病宣传活动总结
2015/05/09 职场文书
嘉年华活动新闻稿
2015/07/17 职场文书
用Python编写简单的gRPC服务的详细过程
2021/07/04 Python
关于JavaScript 中 if包含逗号表达式
2021/11/27 Javascript