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

PHP
php 多线程上下文中安全写文件实现代码
PHP类的使用 实例代码讲解
用php实现让页面只能被百度gogole蜘蛛访问的方法
php 学习笔记
PHP编程过程中需要了解的this,self,parent的区别
php 操作excel文件的方法小结
使用PHP获取网络文件的实现代码
PHP 巧用数组降低程序的时间复杂度
php下将XML转换为数组
php 文件上传代码(限制jpg文件)
php 无极分类(递归)实现代码
PHP 采集获取指定网址的内容
PHP 将图片按创建时间进行分类存储的实现代码
PHP 存储文本换行实现方法
PHP 批量更新网页内容实现代码
用PHP查询搜索引擎排名位置的代码
用php实现的获取网页中的图片并保存到本地的代码
php实现首页链接查询 友情链接检查的代码
处理php自动反斜杠的函数代码
php实现的遍历文件夹下所有文件,编辑删除

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


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

8、注册文件reg.php3
<?
require("common.php3");
require("mail.php3");
if($submit){
if($id=="")error("请填写您的注册用户名!");
elseif(!eregi("^[0-9a-zA_Z]+$",$id))error("你的用户名不能含有其他字符!");
elseif($password=="")error("请填写您的密码!");
elseif($password<>$password1)error("您的密码填写不正确!");
elseif($name=="")error("请填写您的名字!");
elseif($mail=="")error("请填写您的邮件地址!");
else{
$dbm=dbmopen("class","w");
if(dbmexists($dbm,$id))error("这个用户名已经给别人注册了!");
else{
$intro=nl2br($intro);
$data="$name|!:!|$nickname|!:!|$mail|!:!|$home|!:!|$oicq|!:!|$icq|!:!|$add|!:!|$tel|!:!|$birth|!:!|$job|!:!|$intro|!:!|$sex";
dbminsert($dbm,$id,$data);
$pwd=dbmopen("password","w");
dbminsert($pwd,$id,$password);
}
dbmclose($dbm);
$sendmsg="欢迎注册《深圳中学2000届高中(12)班同学录》n";
$sendmsg.="下面是您的注册信息:n";
$sendmsg.="用户名:$idn用户密码;$passwordn";
$sendmsg.="=====================================================";
$sendmsg.="注册姓名:$namen注册昵称:$nicknamen注册邮箱:$mailn主页地址:$homen";
$sendmsg.="您的OICQ:$oicqn您的 ICQ:$icqn联系地址:$addn联系电话:$teln";
$sendmsg.="您的生日:$birthn您的职业:$jobn您的性别;$sexn您的个人介绍:n$intronn";
$sendmsg.="======================================================";
$sendmsg.="欢迎注册《深圳中学2000届高中(12)班同学录》";
$sendmsg.="登陆地址:http://5212.net/class/";
mail2("欢迎注册《深圳中学2000届高中(12)班同学录》",$sendmsg,$mail);
header("Location:index.php3");
}
}else{
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>同学录用户注册</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<link rel="stylesheet" href="style.css">
<META content="MSHTML 5.00.2614.3500" name=GENERATOR>
</HEAD><BODY bgcolor="#FFFFFF" topMargin=0>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%"><BR>
<DIV align=center></DIV><CENTER><TBODY></TBODY></center>
</TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="60%" align="center">
<TBODY> <TR vAlign=top>
<TD bgColor=#000000 width="100%" height="336">
<DIV align=center>
<TABLE border=0 cellPadding=4 cellSpacing=1 height=390 width=586>
<TBODY>
<TR>
<TD align=middle bgColor=#2f5e8c colSpan=2 height=14 vAlign=top><form method="POST" action="reg.php3"> <FONT color=#ffffff>注册同学录</FONT></TD>
</TR>
<TR>
<TD align=middle bgColor=#ffffff height=25 width=150>注册用户名: </TD>
<TD align=left bgColor=#ffffff height=25 width=400>
<INPUT class=stedit maxLength=10 name=id size=23>
*必须填写</TD>
</TR>
<tr>
<td align=middle bgcolor=#ffffff height=25 width=121>您的密码: </td>
<td align=left bgcolor=#ffffff height=25 width=486>
<input class=stedit maxlength=10 name=password size=23 type="password">
*必须填写 </td>
</tr>
<tr>
<td align=middle bgcolor=#ffffff height=25 width=121>重复密码: </td>
<td align=left bgcolor=#ffffff height=25 width=486>
<input type="password" class="stedit" name="password1" size="23" value="">
*必须填写 </td>
</tr>
<tr>
<td align=middle bgcolor=#ffffff height=25 width=121>NickName: </td>
<td align=left bgcolor=#ffffff height=25 width=486>
<input class=stedit maxlength=20 name=nickname size=23>
</td>
</tr>
<TR>
<TD align=middle bgColor=#ffffff height=25 width=121>电子邮件: </TD>
<TD align=left bgColor=#ffffff height=25 width=486>
<INPUT class=stedit maxLength=30 name=mail size=23>
*必须填写 </TD>
</TR>
<tr>
<td align=middle bgcolor=#ffffff height=25 width=121>您的OICQ: </td>
<td align=left bgcolor=#ffffff height=25 width=486>
<input class=stedit maxlength=9 name=oicq size=23>
</td>
</tr>
<tr>
<td align=middle bgcolor=#ffffff height=25 width=121>您的主页: </td>
<td align=left bgcolor=#ffffff height=25 width=486>
<input class=stedit maxlength=50 name=home size=23 value="http://">
</td>
</tr>
<tr>
<td align=middle bgcolor=#ffffff height=25 width=121>您的 ICQ: </td>
<td align=left bgcolor=#ffffff height=25 width=486>
<input class=stedit maxlength=10 name=icq size=23>
</td>
</tr>
<tr>
<td align=middle bgcolor=#ffffff height=25 width=121>您的名字: </td>
<td align=left bgcolor=#ffffff height=25 width=486>
<input class=stedit maxlength=10 name=name size=23>
*必须填写 </td>
</tr>
<tr>
<td align=middle bgcolor=#ffffff height=25 width=121>您的电话: </td>
<td align=left bgcolor=#ffffff height=25 width=486>
<input class=stedit maxlength=20 name=tel size=23>
</td>
</tr>
<tr>
<td align=middle bgcolor=#ffffff height=25 width=121>出生日期: </td>
<td align=left bgcolor=#ffffff height=25 width=486>
<input class=stedit maxlength=11 name=birth size=23>
*类似2000-10-10 </td>
</tr>
<tr>
<td align=middle bgcolor=#ffffff height=25 width=121>联系地址: </td>
<td align=left bgcolor=#ffffff height=25 width=486>
<input class=stedit maxlength=50 name=add size=23>
</td>
</tr>
<tr>
<td align=middle bgcolor=#ffffff height=25 width=121>您的职业: </td>
<td align=left bgcolor=#ffffff height=25 width=486>
<select name="job">
<option value="学 生">学 生</option>
<option value="老 师">老 师</option>
<option value="其 他">其 他</option>
</select>
</td>
</tr>
<tr>
<td align=middle bgcolor=#ffffff height=25 width=121>您的性别: </td>
<td align=left bgcolor=#ffffff height=25 width=486>
<select name="sex">
<option value="俊 男">俊 男</option>
<option value="靓 女">靓 女</option>
<option value="其 他">其 他</option>
</select>
</td>
</tr>
<tr>
<td align=middle bgcolor=#ffffff height=25 width=121>个人简介: </td>
<td align=left bgcolor=#ffffff height=25 width=486>
<textarea class="stedit" name="intro" cols="40" rows="4"></textarea>
</td>
</tr>
<TR bgColor=#ffedc8>
<TD bgColor=#ffffff colSpan=2>
<div align="center">
<input type="submit" name="submit" value="确认申请" class="stbtm">