杏林同学录(六)


Posted in PHP onOctober 09, 2006

注册部分:
   注册步骤1: class/register_step1.php
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>班级通讯录-注册第一步</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<?php
include "config.php";
if ($Submit){
$answers1=trim($answers1);
$answers2=trim($answers2);
if (!($answers1==$answer1)||!($answers2==$answer2)){
echo "回答错误!<a href='javascript:history.back()'>返回</a>";
exit;
}
echo "回答正确,<a href='register_step2.php?answer=right'>进入第二步</a>。";
exit;
}
?>
<table width="73%" border="0" cellspacing="0" cellpadding="0" align="center" height="190">
  <tr>  
    <td height="76">
      <div align="center"><img src="image/classlogo.gif" width="224" height="60"></div>
    </td>
  </tr>
  <tr>
    <td height="32">  
      <div align="center">注册第一步-身份验证</div>
    </td>
  </tr>
  <tr>
    <td height="153">
      <p align="center">请回答以下问题</p>
      <form name="form1" method="post" action="<? echo $PHP_SELF;?>">
        <div align="center">1.<? echo $question1?><br>
          您的回答  
          <input type="text" name="answers1">
          <br>
          2.<? echo $question2?><br>
          您的回答  
          <input type="text" name="answers2">
          <br>
          <input type="submit" name="Submit" value="确认">
          <input type="reset" name="cancel" value="重写">
        </div>
      </form>
      <p align="center"><br>
        <br>
        实在想不起来了,<a href="querypsw.php">问问管理员吧</a>。<br>
      </p>
    </td>
  </tr>
</table>
</BODY>
</HTML>
注册步骤2: class/register_step2.php
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>94级1班通讯录-注册第二步</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<?php
if (!$answer=="right"){          //页面保护
echo "请不要投机取巧!";
exit;
}
include "config.php";
if ($submit){
if (!$username||!$psw||!$psw2||!$name||!$ad||!$ph||!$email){           //检查是否填写完整
      echo "对不起,您2必须填所有带*的项目!<BR>"."<a href='javascript:history.back()'>返回</a>";
      exit;
    }
$username=trim($username);
$psw=trim($psw);
$psw2=trim($psw2);
$name=trim($name);
$birth=$year.'-'.$month.'-'.$day;
$work=trim($work);
$ad=trim($ad);
$post=trim($post);
$ph=trim($ph);
$bp=trim($bp);
$email=trim($email);
$oicq=trim($oicq);
$account=strip_tags(trim($account));//去掉首尾空格及html标记
$signature=strip_tags(trim($signature));
//检验此名字是否已被注册
$result = mysql_query("SELECT name FROM user where name='$name'",$db);
if (mysql_num_rows($result)!=0){   
echo "此名字已有人注册!"."<a href='javascript:history.back()'>重新填写</a> "."忘记密码,向管理员<a href='querypsw.php'>索要密码</a>";
exit;
}
//检验用户名是否被使用
$result = mysql_query("SELECT user FROM user where user='$username'",$db);//若返回列的数目不为0,说明此用户名已有人使用
if (mysql_num_rows($result)!=0){   
echo "此用户名已有人使用!"."<a href='javascript:history.back()'>重新填写</a>";
exit;
}
//检查密码重复是否正确
if (!$psw==$psw2){
echo "请确认密码,<a href='javascript:history.back()'>返回</a>";
exit;
}
//检查email的合法性
if(!ereg('^[-!#$%&'*+./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%&'*+\/0-9=?A-Z^_`a-z{|}~]+.'.'[-!#$%&'*+\./0-9=?A-Z^_`a-z{|}~]+$',$email)&&$email){
       echo "email不合法!<BR>"."<a href='javascript:history.back()'>重填</a><BR>";
       exit;}
//写入数据库
  $sql="INSERT INTO user (user,psw,name,sex,birth,work,ad,post,ph,bp,email,oicq,account,signature,face) VALUES ('$username','$psw','$name','$sex','$birth','$work','$ad','$post','$ph','$bp','$email','$oicq','$account','$signature','$face')";
$result = mysql_query($sql,$db);
mysql_close($db);
//发祝贺邮件
$subject="祝贺你成功注册".$sitename."!";//主题
$message=$name.",你好:<BR>  祝贺你成功注册同学录!您的用户名为".$username.",密码为".$psw."<BR>现在登陆<a href='$url'>$sitename</a>";//信件内容
$headers .= "Content-Type: text/html; charset=gb2312n"; // Mime type
mail($email,$subject,$message,$headers);//离线状态下调试时,这一句可能会出错,不必管它,传到服务器上即可。
echo "恭喜您注册成功!一封欢迎信已发到您的邮箱,请注意查收。","<a href='../index.php'>现在登录</a>";  
exit;
}  
?>
<table width='95%' border='0' cellspacing='0' cellpadding='0' align='center'>
  <tr>  
    <td colspan="2">  
      <div align="center"><img src="image/classlogo.gif" width="224" height="60"></div>
    </td>
  </tr>
  <tr>  
    <td>  
      <div align="center">注册第二步-填写个人资料<br>
        注意不要有空格,带*的项目为必填。</div>
    </td>
  </tr>
  <tr>  
    <td colspan="2">  
      <form method='post' action='<? echo $PHP_SELF;?>?answer=right'>
        <table width="95%" border="1" cellspacing="1" cellpadding="0" align="center" bordercolor="#FFCC00">
          <tr>
            <td height="153" width="60%"><br>
              用户名:  
              <input type='Text' name='username' size='12' maxlength='12'>
              *<br>
              (英文字母或加数字,长度不超过12)<br>
          密码:  
          <input type='password' name='psw' size='8' maxlength='8'>
              *<br>
              (英文字母或加数字,长度不超过8个字符)<br>
          确认密码:  
          <input type='password' name='psw2' size='8' maxlength='8'>
          *<br>
          姓名:  
          <input type='Text' name='name' size='8' maxlength='8'>
          *<br>
          性别:男  
          <input type='radio' name='sex' value='男' checked>
          女  
          <input type='radio' name='sex' value='女'>
          <br>
          生日:  
          <select name='year'>
            <option selected>1991</option>
            <option>1990</option>
            <option>1989</option>
            <option>1988</option>
            <option>1987</option>
            <option>1986</option>
            <option>1985</option>
            <option>1984</option>
            <option>1983</option>
            <option>1982</option>
            <option>1981</option>
            <option>1980</option>
            <option>1979</option>
            <option>1978</option>
            <option>1977</option>
            <option>1976</option>
            <option>1975</option>
            <option>1974</option>
            <option>1973</option>
            <option>1972</option>
            <option>1971</option>
            <option>1970</option>
            <option>1969</option>
            <option>1968</option>
            <option>1967</option>
            <option>1966</option>
            <option>1965</option>
            <option>1964</option>
            <option>1963</option>
            <option>1962</option>
            <option>1961</option>
            <option>1960</option>
            <option>1959</option>
            <option>1958</option>
            <option>1957</option>
            <option>1956</option>
            <option>1955</option>
            <option>1954</option>
          </select>
          年  
          <select name='month'>
            <option selected>01</option>
            <option>02</option>
            <option>03</option>
            <option>04</option>
            <option>05</option>
            <option>06</option>
            <option>07</option>
            <option>08</option>
            <option>09</option>
            <option>10</option>
            <option>11</option>
            <option>12</option>
          </select>
          月  
          <select name='day'>
            <option selected>01</option>
            <option>02</option>
            <option>03</option>
            <option>04</option>
            <option>05</option>
            <option>06</option>
            <option>07</option>
            <option>08</option>
            <option>09</option>
            <option>10</option>
            <option>11</option>
            <option>12</option>
            <option>13</option>
            <option>14</option>
            <option>15</option>
            <option>16</option>
            <option>17</option>
            <option>18</option>
            <option>19</option>
            <option>20</option>
            <option>21</option>
            <option>22</option>
            <option>23</option>
            <option>24</option>
            <option>25</option>
            <option>26</option>
            <option>27</option>
            <option>28</option>
            <option>29</option>
            <option>30</option>
            <option>31</option>
          </select>
          日<br>
          工作单位:  
          <input type='Text' name='work' size='30' maxlength='50'>
          <br>
          通讯地址:  
          <input type='Text' name='ad' size='30' maxlength='50'>
          *<br>
          邮编:  
          <input type='Text' name='post' size='6' maxlength='6'>
          <br>
          电话:  
          <input type='Text' name='ph' size='15' maxlength='30'>
          *<br>
          传呼:  
          <input type='Text' name='bp' size='15' maxlength='20'>
          <br>
          Email:  
          <input type='Text' name='email' size='15' maxlength='35'>
          *<br>
          oicq:  
          <input type='Text' name='oicq' size='12' maxlength='12'>
          <br>
          个人说明:(在通讯录里显示,不超过125个汉字)<BR>
          <textarea name='account' cols='50' rows='5'></textarea>
          <br>
          个人签名:(在留言簿的自动签名,不超过125个汉字)<br>
              <textarea name="signature" cols="50" rows="5"></textarea>
            </td>
            <td height="153" width="40%"><br>
              选择一个自己喜欢的头像:<br>
          <img src="image/face/icon1.gif" width="32" height="32">  
          <input type="radio" name="face" value="1" checked>
          <img src="image/face/icon2.gif" width="32" height="32">  
          <input type="radio" name="face" value="2">
          <img src="image/face/icon3.gif" width="32" height="32">  
          <input type="radio" name="face" value="3">
          <img src="image/face/icon4.gif" width="32" height="32">  
          <input type="radio" name="face" value="4">
          <img src="image/face/icon5.gif" width="32" height="32">  
          <input type="radio" name="face" value="5">
          <img src="image/face/icon6.gif" width="32" height="32">  
          <input type="radio" name="face" value="6">
          <img src="image/face/icon7.gif" width="32" height="32">  
          <input type="radio" name="face" value="7">
          <img src="image/face/icon8.gif" width="32" height="32">  
          <input type="radio" name="face" value="8">
          <img src="image/face/icon9.gif" width="32" height="32">  
          <input type="radio" name="face" value="9">
          <img src="image/face/icon10.gif" width="32" height="32">  
          <input type="radio" name="face" value="10">
              <img src="image/face/icon11.gif" width="32" height="32">  
              <input type="radio" name="face" value="11">
          <img src="image/face/icon12.gif" width="32" height="32">  
          <input type="radio" name="face" value="12">
          <img src="image/face/icon13.gif" width="32" height="32">  
          <input type="radio" name="face" value="13">
          <img src="image/face/icon14.gif" width="32" height="32">  
          <input type="radio" name="face" value="14">
          <img src="image/face/icon15.gif" width="32" height="32">  
          <input type="radio" name="face" value="15">
          <img src="image/face/icon16.gif" width="32" height="32">  
          <input type="radio" name="face" value="16">
          <img src="image/face/icon17.gif" width="32" height="32">  
          <input type="radio" name="face" value="17">
          <img src="image/face/icon18.gif" width="32" height="32">  
          <input type="radio" name="face" value="18">
          <img src="image/face/icon19.gif" width="32" height="32">  
          <input type="radio" name="face" value="19">
          <img src="image/face/icon20.gif" width="32" height="32">  
          <input type="radio" name="face" value="20">
          <br>
          <img src="image/face/icon21.gif" width="32" height="32">  
          <input type="radio" name="face" value="21">
          <img src="image/face/icon22.gif" width="32" height="32">  
          <input type="radio" name="face" value="22">
          <img src="image/face/icon23.gif" width="32" height="32">  
          <input type="radio" name="face" value="23">
          <img src="image/face/icon24.gif" width="32" height="32">  
          <input type="radio" name="face" value="24">
          <img src="image/face/icon25.gif" width="32" height="32">  
          <input type="radio" name="face" value="25">
          <img src="image/face/icon26.gif" width="32" height="32">  
          <input type="radio" name="face" value="26">
          <img src="image/face/icon27.gif" width="32" height="32">  
          <input type="radio" name="face" value="27">
          <img src="image/face/icon28.gif" width="32" height="32">  
          <input type="radio" name="face" value="28">
          <img src="image/face/icon29.gif" width="32" height="32">  
          <input type="radio" name="face" value="29">
          <img src="image/face/icon30.gif" width="32" height="32">  
          <input type="radio" name="face" value="30">
          <img src="image/face/icon31.gif" width="32" height="32">  
          <input type="radio" name="face" value="31">
          <img src="image/face/icon32.gif" width="32" height="32">  
          <input type="radio" name="face" value="32">
          <img src="image/face/icon33.gif" width="32" height="32">  
          <input type="radio" name="face" value="33">
          <img src="image/face/icon34.gif" width="32" height="32">  
          <input type="radio" name="face" value="34">
          <img src="image/face/icon35.gif" width="32" height="32">  
          <input type="radio" name="face" value="35">
          <img src="image/face/icon36.gif" width="32" height="32">  
          <input type="radio" name="face" value="36">
          <img src="image/face/icon37.gif" width="32" height="32">  
          <input type="radio" name="face" value="37">
          <img src="image/face/icon38.gif" width="32" height="32">  
          <input type="radio" name="face" value="38">
          <img src="image/face/icon39.gif" width="32" height="32">  
          <input type="radio" name="face" value="39">
          <img src="image/face/icon40.gif" width="32" height="32">  
          <input type="radio" name="face" value="40">
          <br>
          <img src="image/face/icon41.gif" width="32" height="32">  
          <input type="radio" name="face" value="41">
          <img src="image/face/icon42.gif" width="32" height="32">  
          <input type="radio" name="face" value="42">
          <img src="image/face/icon43.gif" width="32" height="32">  
          <input type="radio" name="face" value="43">
          <img src="image/face/icon44.gif" width="32" height="32">  
          <input type="radio" name="face" value="44">
          <img src="image/face/icon45.gif" width="32" height="32">  
          <input type="radio" name="face" value="45">
          <img src="image/face/icon46.gif" width="32" height="32">  
          <input type="radio" name="face" value="46">
          <img src="image/face/icon47.gif" width="32" height="32">  
          <input type="radio" name="face" value="47">
          <img src="image/face/icon48.gif" width="32" height="32">  
          <input type="radio" name="face" value="48">
          <img src="image/face/icon49.gif" width="32" height="32">  
          <input type="radio" name="face" value="49">
          <img src="image/face/icon50.gif" width="32" height="32">  
          <input type="radio" name="face" value="50">
              <img src="image/face/icon51.gif" width="32" height="32">  
              <input type="radio" name="face" value="51">
          <img src="image/face/icon52.gif" width="32" height="32">  
          <input type="radio" name="face" value="52">
          <img src="image/face/icon53.gif" width="32" height="32">  
          <input type="radio" name="face" value="53">
          <img src="image/face/icon54.gif" width="32" height="32">  
          <input type="radio" name="face" value="54">
          <img src="image/face/icon55.gif" width="32" height="32">  
          <input type="radio" name="face" value="55">
          <img src="image/face/icon56.gif" width="32" height="32">  
          <input type="radio" name="face" value="56">
          <img src="image/face/icon57.gif" width="32" height="32">  
          <input type="radio" name="face" value="57">
          <img src="image/face/icon58.gif" width="32" height="32">  
          <input type="radio" name="face" value="58">
          <img src="image/face/icon59.gif" width="32" height="32">  
          <input type="radio" name="face" value="59">
          <img src="image/face/icon60.gif" width="32" height="32">  
          <input type="radio" name="face" value="60">
          <br>
          <img src="image/face/icon61.gif" width="32" height="32">  
          <input type="radio" name="face" value="61">
          <img src="image/face/icon62.gif" width="32" height="32">  
          <input type="radio" name="face" value="62">
          <img src="image/face/icon63.gif" width="32" height="32">  
          <input type="radio" name="face" value="63">
          <img src="image/face/icon64.gif" width="32" height="32">  
          <input type="radio" name="face" value="64">
          <br>
            </td>
          </tr>
        </table>
        <div align="center">
          <br>
          <input type='Submit' name='submit' value='提交'>
          <input type='reset' name='Reset' value='重写 '>
        </div>
      </form>
    </td>
  </tr>
</table>
</BODY>
</HTML> 

PHP 相关文章推荐
php smarty的预保留变量总结
Dec 04 PHP
PHP无限分类代码,支持数组格式化、直接输出菜单两种方式
May 18 PHP
编写php应用程序实现摘要式身份验证的方法详解
Jun 08 PHP
PHP多例模式介绍
Jun 24 PHP
修改apache配置文件去除thinkphp url中的index.php
Jan 17 PHP
php实现的任意进制互转类分享
Jul 07 PHP
php 中奖概率算法实现代码
Jan 25 PHP
PHP实现模拟http请求的方法分析
Dec 20 PHP
PHPMailer ThinkPHP实现自动发送邮件功能
Jun 10 PHP
PHP中检查isset()和!empty()函数的必要性
Feb 13 PHP
PHP get_html_translation_table()函数用法讲解
Feb 16 PHP
php post换行的方法
Feb 03 PHP
杏林同学录(八)
Oct 09 #PHP
PHP的FTP学习(四)
Oct 09 #PHP
杏林同学录(七)
Oct 09 #PHP
一个连接两个不同MYSQL数据库的PHP程序
Oct 09 #PHP
我的论坛源代码(一)
Oct 09 #PHP
我的论坛源代码(二)
Oct 09 #PHP
我的论坛源代码(三)
Oct 09 #PHP
You might like
php+mysqli使用预处理技术进行数据库查询的方法
2015/01/28 PHP
PHP中使用socket方式GET、POST数据实例
2015/04/02 PHP
yii2.0整合阿里云oss删除单个文件的方法
2017/09/19 PHP
ie focus bug 解决方法
2009/09/03 Javascript
window.js 主要包含了页面的一些操作
2009/12/23 Javascript
js中parseFloat(参数1,参数2)定义和用法及注意事项
2013/01/27 Javascript
Jquery通过Ajax方式来提交Form表单的具体实现
2013/11/07 Javascript
jquery实现图片滚动效果的简单实例
2013/11/23 Javascript
基于jQuery插件实现点击小图显示大图效果
2016/05/11 Javascript
jQuery插件实现文件上传功能(支持拖拽)
2020/08/27 Javascript
javascript实现秒表计时器的制作方法
2017/02/16 Javascript
详谈commonjs模块与es6模块的区别
2017/10/18 Javascript
jQuery Dom元素操作技巧
2018/02/04 jQuery
React 项目迁移 Webpack Babel7的实现
2018/09/12 Javascript
微信小程序动态评分展示/五角星展示/半颗星展示/自定义长度展示功能的实现
2020/07/22 Javascript
[04:29]DOTA2亚洲邀请赛小组赛第一日 TOP10精彩集锦
2015/02/01 DOTA
[44:51]2018DOTA2亚洲邀请赛 4.4 淘汰赛 VP vs Liquid 第二场
2018/04/05 DOTA
一行代码让 Python 的运行速度提高100倍
2018/10/08 Python
python3.6 如何将list存入txt后再读出list的方法
2019/07/02 Python
python爬虫解决验证码的思路及示例
2019/08/01 Python
Python提取PDF内容的方法(文本、图像、线条等)
2019/09/25 Python
python字典的值可以修改吗
2020/06/29 Python
python 实现批量图片识别并翻译
2020/11/02 Python
纯CSS3制作的鼠标悬停时边框旋转
2017/01/03 HTML / CSS
Mamaearth官方网站:印度母婴护理产品公司
2019/10/06 全球购物
元旦活动感言
2014/03/08 职场文书
产品设计开发计划书
2014/05/07 职场文书
财会专业大学生求职信
2014/09/26 职场文书
战略性融资合作协议书范本
2014/10/17 职场文书
数学教师个人工作总结
2015/02/06 职场文书
第28个世界无烟日活动总结
2015/02/10 职场文书
初中毕业感言300字
2015/07/31 职场文书
Golang解析JSON对象
2022/04/30 Golang
Python 匹配文本并在其上一行追加文本
2022/05/11 Python
MySQL数据库实验之 触发器和存储过程
2022/06/21 MySQL
Python通用验证码识别OCR库ddddocr的安装使用教程
2022/07/07 Python