杏林同学录(六)

注册部分:
注册步骤1: class/register_step1.php

1<html>
2<head>
3<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
4<title>班级通讯录-注册第一步</title>
5</head>
6<body bgcolor="#FFFFFF">   

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;
}

 1<table align="center" border="0" cellpadding="0" cellspacing="0" height="190" width="73%">
 2<tr>
 3<td height="76">
 4<div align="center"><img height="60" src="image/classlogo.gif" width="224"/></div>
 5</td>
 6</tr>
 7<tr>
 8<td height="32">
 9<div align="center">注册第一步-身份验证</div>
10</td>
11</tr>
12<tr>
13<td height="153">
14<p align="center">请回答以下问题</p>
15<form action="&lt;? echo $PHP_SELF;?&gt;" method="post" name="form1">
16<div align="center">1.<? echo $question1?><br/>   
17您的回答   
18<input name="answers1" type="text"/>
19<br/>   
202.<? echo $question2?><br/>   
21您的回答   
22<input name="answers2" type="text"/>
23<br/>
24<input name="Submit" type="submit" value="确认"/>
25<input name="cancel" type="reset" value="重写"/>
26</div>
27</form>
28<p align="center"><br/>
29<br/>   
30实在想不起来了,<a href="querypsw.php">问问管理员吧</a>。<br/>
31</p>
32</td>
33</tr>
34</table>
35</body>
36</html>

注册步骤2: class/register_step2.php

1<html>
2<head>
3<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
4<title>94级1班通讯录-注册第二步</title>
5</head>
6<body bgcolor="#FFFFFF">   

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('^[-!#$%&amp;'
+./0-9=?A-Z^a-z{|}~]+'.'@'.'[-!#$%&amp;amp;'*+\/0-9=?A-Z^_a-z{|}~]+.'.'[-!#$%&amp;'*+\./0-9=?A-Z^`a-z{|}~]+$',$email)&amp;&amp;$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;
}

  1<table align="center" border="0" cellpadding="0" cellspacing="0" width="95%">
  2<tr>
  3<td colspan="2">
  4<div align="center"><img height="60" src="image/classlogo.gif" width="224"/></div>
  5</td>
  6</tr>
  7<tr>
  8<td>
  9<div align="center">注册第二步-填写个人资料<br/>   
 10注意不要有空格,带*的项目为必填。</div>
 11</td>
 12</tr>
 13<tr>
 14<td colspan="2">
 15<form action="&lt;? echo $PHP_SELF;?&gt;?answer=right" method="post">
 16<table align="center" border="1" bordercolor="#FFCC00" cellpadding="0" cellspacing="1" width="95%">
 17<tr>
 18<td height="153" width="60%"><br/>   
 19用户名:   
 20<input maxlength="12" name="username" size="12" type="Text"/>   
 21*<br/>   
 22(英文字母或加数字,长度不超过12)<br/>   
 23密码:   
 24<input maxlength="8" name="psw" size="8" type="password"/>   
 25*<br/>   
 26(英文字母或加数字,长度不超过8个字符)<br/>   
 27确认密码:   
 28<input maxlength="8" name="psw2" size="8" type="password"/>   
 29*<br/>   
 30姓名:   
 31<input maxlength="8" name="name" size="8" type="Text"/>   
 32*<br/>   
 33性别:男   
 34<input checked="" name="sex" type="radio" value="男"/>   
 35 36<input name="sex" type="radio" value="女"/>
 37<br/>   
 38生日:   
 39<select name="year">
 40<option selected="">1991</option>
 41<option>1990</option>
 42<option>1989</option>
 43<option>1988</option>
 44<option>1987</option>
 45<option>1986</option>
 46<option>1985</option>
 47<option>1984</option>
 48<option>1983</option>
 49<option>1982</option>
 50<option>1981</option>
 51<option>1980</option>
 52<option>1979</option>
 53<option>1978</option>
 54<option>1977</option>
 55<option>1976</option>
 56<option>1975</option>
 57<option>1974</option>
 58<option>1973</option>
 59<option>1972</option>
 60<option>1971</option>
 61<option>1970</option>
 62<option>1969</option>
 63<option>1968</option>
 64<option>1967</option>
 65<option>1966</option>
 66<option>1965</option>
 67<option>1964</option>
 68<option>1963</option>
 69<option>1962</option>
 70<option>1961</option>
 71<option>1960</option>
 72<option>1959</option>
 73<option>1958</option>
 74<option>1957</option>
 75<option>1956</option>
 76<option>1955</option>
 77<option>1954</option>
 78</select>   
 79 80<select name="month">
 81<option selected="">01</option>
 82<option>02</option>
 83<option>03</option>
 84<option>04</option>
 85<option>05</option>
 86<option>06</option>
 87<option>07</option>
 88<option>08</option>
 89<option>09</option>
 90<option>10</option>
 91<option>11</option>
 92<option>12</option>
 93</select>   
 94 95<select name="day">
 96<option selected="">01</option>
 97<option>02</option>
 98<option>03</option>
 99<option>04</option>
100<option>05</option>
101<option>06</option>
102<option>07</option>
103<option>08</option>
104<option>09</option>
105<option>10</option>
106<option>11</option>
107<option>12</option>
108<option>13</option>
109<option>14</option>
110<option>15</option>
111<option>16</option>
112<option>17</option>
113<option>18</option>
114<option>19</option>
115<option>20</option>
116<option>21</option>
117<option>22</option>
118<option>23</option>
119<option>24</option>
120<option>25</option>
121<option>26</option>
122<option>27</option>
123<option>28</option>
124<option>29</option>
125<option>30</option>
126<option>31</option>
127</select>   
128日<br/>   
129工作单位:   
130<input maxlength="50" name="work" size="30" type="Text"/>
131<br/>   
132通讯地址:   
133<input maxlength="50" name="ad" size="30" type="Text"/>   
134*<br/>   
135邮编:   
136<input maxlength="6" name="post" size="6" type="Text"/>
137<br/>   
138电话:   
139<input maxlength="30" name="ph" size="15" type="Text"/>   
140*<br/>   
141传呼:   
142<input maxlength="20" name="bp" size="15" type="Text"/>
143<br/>   
144Email:   
145<input maxlength="35" name="email" size="15" type="Text"/>   
146*<br/>   
147oicq:   
148<input maxlength="12" name="oicq" size="12" type="Text"/>
149<br/>   
150个人说明:(在通讯录里显示,不超过125个汉字)<br/>
151<textarea cols="50" name="account" rows="5"></textarea>
152<br/>   
153个人签名:(在留言簿的自动签名,不超过125个汉字)<br/>
154<textarea cols="50" name="signature" rows="5"></textarea>
155</td>
156<td height="153" width="40%"><br/>   
157选择一个自己喜欢的头像:<br/>
158<img height="32" src="image/face/icon1.gif" width="32"/>
159<input checked="" name="face" type="radio" value="1"/>
160<img height="32" src="image/face/icon2.gif" width="32"/>
161<input name="face" type="radio" value="2"/>
162<img height="32" src="image/face/icon3.gif" width="32"/>
163<input name="face" type="radio" value="3"/>
164<img height="32" src="image/face/icon4.gif" width="32"/>
165<input name="face" type="radio" value="4"/>
166<img height="32" src="image/face/icon5.gif" width="32"/>
167<input name="face" type="radio" value="5"/>
168<img height="32" src="image/face/icon6.gif" width="32"/>
169<input name="face" type="radio" value="6"/>
170<img height="32" src="image/face/icon7.gif" width="32"/>
171<input name="face" type="radio" value="7"/>
172<img height="32" src="image/face/icon8.gif" width="32"/>
173<input name="face" type="radio" value="8"/>
174<img height="32" src="image/face/icon9.gif" width="32"/>
175<input name="face" type="radio" value="9"/>
176<img height="32" src="image/face/icon10.gif" width="32"/>
177<input name="face" type="radio" value="10"/>
178<img height="32" src="image/face/icon11.gif" width="32"/>
179<input name="face" type="radio" value="11"/>
180<img height="32" src="image/face/icon12.gif" width="32"/>
181<input name="face" type="radio" value="12"/>
182<img height="32" src="image/face/icon13.gif" width="32"/>
183<input name="face" type="radio" value="13"/>
184<img height="32" src="image/face/icon14.gif" width="32"/>
185<input name="face" type="radio" value="14"/>
186<img height="32" src="image/face/icon15.gif" width="32"/>
187<input name="face" type="radio" value="15"/>
188<img height="32" src="image/face/icon16.gif" width="32"/>
189<input name="face" type="radio" value="16"/>
190<img height="32" src="image/face/icon17.gif" width="32"/>
191<input name="face" type="radio" value="17"/>
192<img height="32" src="image/face/icon18.gif" width="32"/>
193<input name="face" type="radio" value="18"/>
194<img height="32" src="image/face/icon19.gif" width="32"/>
195<input name="face" type="radio" value="19"/>
196<img height="32" src="image/face/icon20.gif" width="32"/>
197<input name="face" type="radio" value="20"/>
198<br/>
199<img height="32" src="image/face/icon21.gif" width="32"/>
200<input name="face" type="radio" value="21"/>
201<img height="32" src="image/face/icon22.gif" width="32"/>
202<input name="face" type="radio" value="22"/>
203<img height="32" src="image/face/icon23.gif" width="32"/>
204<input name="face" type="radio" value="23"/>
205<img height="32" src="image/face/icon24.gif" width="32"/>
206<input name="face" type="radio" value="24"/>
207<img height="32" src="image/face/icon25.gif" width="32"/>
208<input name="face" type="radio" value="25"/>
209<img height="32" src="image/face/icon26.gif" width="32"/>
210<input name="face" type="radio" value="26"/>
211<img height="32" src="image/face/icon27.gif" width="32"/>
212<input name="face" type="radio" value="27"/>
213<img height="32" src="image/face/icon28.gif" width="32"/>
214<input name="face" type="radio" value="28"/>
215<img height="32" src="image/face/icon29.gif" width="32"/>
216<input name="face" type="radio" value="29"/>
217<img height="32" src="image/face/icon30.gif" width="32"/>
218<input name="face" type="radio" value="30"/>
219<img height="32" src="image/face/icon31.gif" width="32"/>
220<input name="face" type="radio" value="31"/>
221<img height="32" src="image/face/icon32.gif" width="32"/>
222<input name="face" type="radio" value="32"/>
223<img height="32" src="image/face/icon33.gif" width="32"/>
224<input name="face" type="radio" value="33"/>
225<img height="32" src="image/face/icon34.gif" width="32"/>
226<input name="face" type="radio" value="34"/>
227<img height="32" src="image/face/icon35.gif" width="32"/>
228<input name="face" type="radio" value="35"/>
229<img height="32" src="image/face/icon36.gif" width="32"/>
230<input name="face" type="radio" value="36"/>
231<img height="32" src="image/face/icon37.gif" width="32"/>
232<input name="face" type="radio" value="37"/>
233<img height="32" src="image/face/icon38.gif" width="32"/>
234<input name="face" type="radio" value="38"/>
235<img height="32" src="image/face/icon39.gif" width="32"/>
236<input name="face" type="radio" value="39"/>
237<img height="32" src="image/face/icon40.gif" width="32"/>
238<input name="face" type="radio" value="40"/>
239<br/>
240<img height="32" src="image/face/icon41.gif" width="32"/>
241<input name="face" type="radio" value="41"/>
242<img height="32" src="image/face/icon42.gif" width="32"/>
243<input name="face" type="radio" value="42"/>
244<img height="32" src="image/face/icon43.gif" width="32"/>
245<input name="face" type="radio" value="43"/>
246<img height="32" src="image/face/icon44.gif" width="32"/>
247<input name="face" type="radio" value="44"/>
248<img height="32" src="image/face/icon45.gif" width="32"/>
249<input name="face" type="radio" value="45"/>
250<img height="32" src="image/face/icon46.gif" width="32"/>
251<input name="face" type="radio" value="46"/>
252<img height="32" src="image/face/icon47.gif" width="32"/>
253<input name="face" type="radio" value="47"/>
254<img height="32" src="image/face/icon48.gif" width="32"/>
255<input name="face" type="radio" value="48"/>
256<img height="32" src="image/face/icon49.gif" width="32"/>
257<input name="face" type="radio" value="49"/>
258<img height="32" src="image/face/icon50.gif" width="32"/>
259<input name="face" type="radio" value="50"/>
260<img height="32" src="image/face/icon51.gif" width="32"/>
261<input name="face" type="radio" value="51"/>
262<img height="32" src="image/face/icon52.gif" width="32"/>
263<input name="face" type="radio" value="52"/>
264<img height="32" src="image/face/icon53.gif" width="32"/>
265<input name="face" type="radio" value="53"/>
266<img height="32" src="image/face/icon54.gif" width="32"/>
267<input name="face" type="radio" value="54"/>
268<img height="32" src="image/face/icon55.gif" width="32"/>
269<input name="face" type="radio" value="55"/>
270<img height="32" src="image/face/icon56.gif" width="32"/>
271<input name="face" type="radio" value="56"/>
272<img height="32" src="image/face/icon57.gif" width="32"/>
273<input name="face" type="radio" value="57"/>
274<img height="32" src="image/face/icon58.gif" width="32"/>
275<input name="face" type="radio" value="58"/>
276<img height="32" src="image/face/icon59.gif" width="32"/>
277<input name="face" type="radio" value="59"/>
278<img height="32" src="image/face/icon60.gif" width="32"/>
279<input name="face" type="radio" value="60"/>
280<br/>
281<img height="32" src="image/face/icon61.gif" width="32"/>
282<input name="face" type="radio" value="61"/>
283<img height="32" src="image/face/icon62.gif" width="32"/>
284<input name="face" type="radio" value="62"/>
285<img height="32" src="image/face/icon63.gif" width="32"/>
286<input name="face" type="radio" value="63"/>
287<img height="32" src="image/face/icon64.gif" width="32"/>
288<input name="face" type="radio" value="64"/>
289<br/>
290</td>
291</tr>
292</table>
293<div align="center">
294<br/>
295<input name="submit" type="Submit" value="提交"/>
296<input name="Reset" type="reset" value="重写 "/>
297</div>
298</form>
299</td>
300</tr>
301</table>
302</body>
303</html>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus