<?
session_start();
include("config.inc.php");
include("dbconnect.inc.php");
$username = $_GET["username"];
if($_GET["do"] == "1")
{
$username=$_POST["username"];
$password=$_POST["userpass1"];
$realname=$_POST["realname"];
$birthday=$_POST["useryear"]."年".$_POST["usermonth"]."月".$_POST["userday"] ."日";
$sex=$_POST["usersex"];
$blood_type=$_POST["userblood"];
$native_place=$_POST["userfrom"];
$hobby=$_POST["userhobby"];
$homepage=$_POST["userpage"];
$qq=$_POST["userqq"];
$usermail=$_POST["usermail"];
$mobile=$_POST["usermobi"];
$tel=$_POST["usertel"];
$address=$_POST["useraddr"];
$zip=$_POST["userzip"];
$words=$_POST["userwords"];
$datetime = date("Y-m-d H:i:s");
$sql ="INSERT INTO `user` ( `id` , `username` , `password` , `realname` , `birthday` , `sex` , `blood_type` , `native_place` , `hobby` , `mail` , `qq` , `homepage` , `mobile` , `tel` , `address` , `zip` , `words` , `level` , `create_time` ) ";
$sql .="VALUES ('', '{$username}', '{$password}', '{$realname}', '{$birthday}', '{$sex}', '{$blood_type}', '{$native_place}', '{$hobby}', '{$usermail}', '{$qq}', '{$homepage}', '{$mobile}', '{$tel}', '{$address}', '{$zip}', '{$words}', ' user', '{$datetime}')";
if(mysql_query($sql))
{
$message = "添加完成";
$id = mysql_insert_id();
header("Location:regok.php?username=$username");
}
else
{
$message = "添加失败,数据库错误";
}
}
?>
<?include "head.inc.php"?>
<script language="JavaScript">
<!--
function Juge(theForm)
{
if (theForm.userpass1.value == "")
{
alert("请输入您的密码!");
theForm.userpass1.focus();
return (false);
}
if (theForm.userpass2.value == "")
{
alert("请输入确认密码!");
theForm.userpass2.focus();
return (false);
}
if (theForm.userpass1.value.length <3 || theForm.userpass1.value.length >20)
{
alert("密码长度不正确!");
theForm.userpass1.focus();
return (false);
}
if (theForm.userpass1.value != theForm.userpass2.value)
{
alert("两次输入的密码不同!");
theForm.userpass1.focus();
theForm.userpass2.focus();
return (false);
}
if (theForm.realname.value == "")
{
alert("请输入真实姓名!");
theForm.username.focus();
return (false);
}
if (theForm.useryear.value == "19" || theForm.useryear.value == "")
{
alert("请输入出生年份!");
theForm.useryear.focus();
return (false);
}
if (theForm.usersex.value == "请选择")
{
alert("请选择性别!");
theForm.usersex.focus();
return (false);
}
}
-->
</script>
<table width="778" border="0" cellpadding="0" cellspacing="6" class="border">
<tr>
<td>
<form method="post" action="reginfo.php?do=1" onSubmit="return Juge(this)">
<table width="550" border="0" cellspacing="2" cellpadding="2" align="center">
<tr>
<td align="center"><b><font color="#458B00">用户注册</font></b></td>
</tr>
<tr>
<td>欢迎您,<?echo $username;?>!<br>
为了方便您的同学与您联系,请您认真填写下面的个人信息,带<font color="red">*</font>的为必填信息。</td>
</tr>
</table>
<table width="550" border="1" cellspacing="0" cellpadding="2" align="center" bordercolorlight="#00FF00" bordercolordark="#FFFFFF">
<tr><td align="center">用户帐号:</td><td><?echo $username;?><input type="hidden" name="username" value="<?echo $username;?>"><font color="red">*(若要修改请点击<a href="javascript:history.back(1)">返回</a>)</font></td></tr>
<tr>
<td width="30%">
<div align="center">密码:</div>
</td>
<td>
<input type="password" name="userpass1" size="16" class=text><font color="red">*(英文、数字或下划线,长度在3~20之间)</font>
</td>
</tr>
<tr>
<td width="30%">
<div align="center">确认密码:</div>
</td>
<td>
<input type="password" name="userpass2" size="16" class=text><font color="red">*(英文、数字或下划线,长度在3~20之间)</font>
</td>
</tr>
<tr>
<td colspan="2">
<div align="center"><b>个人真实资料</b></div>
</td>
</tr>
<tr><td width="30%">
<div align="center">真实姓名:</div>
</td>
<td>
<input name="realname" size="16" class=text><font color="red">*</font></font>
</td>
</tr>
<tr>
<td width="30%">
<div align="center">生日:</div>
</td>
<td >
<input type="text" name="useryear" maxlength="4" size="5" value="19" class=text>
年
<select name="usermonth">
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
月
<select name="userday">
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>
日 <font color="red">*</font></td>
</tr>
<tr>
<td width="30%">
<div align="center">性别:</div>
</td>
<td>
<select name="usersex">
<option value="请选择">请选择</option>
<option value="男">男</option>
<option value="女">女</option>
</select><font color="red">*</font>
</td>
</tr>
<tr>
<td width="30%">
<div align="center">血型:</div>
</td>
<td>
<select name="userblood">
<option value="">请选择</option>
<option value="A">A</option>
<option value="B">B</option>
<option value="AB">AB</option>
<option value="O">O</option>
</select>
型 </td>
</tr>
<tr>
<td width="30%">
<div align="center">籍贯:</div>
</td>
<td><font color="#800000">
<select name="userfrom" size="1">
<option value="">请选择</option>
<option VALUE="北京">北京</option>
<option VALUE="安徽">安徽</option>
<option VALUE="重庆">重庆</option>
<option VALUE="福建">福建</option>
<option VALUE="甘肃">甘肃</option>
<option VALUE="广东">广东</option>
<option VALUE="广西">广西</option>
<option VALUE="贵州">贵州</option>
<option VALUE="海南">海南</option>
<option VALUE="河北">河北</option>
<option VALUE="黑龙江">黑龙江</option>