<script language="javascript">
function Showlist()
{
if (form1.rad_usertype[0].checked)
{form1.usertype.value=0;}
else if (form1.rad_usertype[1].checked)
{form1.usertype.value=1;}
else if (form1.rad_usertype[2].checked)
{form1.usertype.value=2;}
if (form1.rad_usertype[1].checked)
{
t_list.style.display="block";
}
else
{
t_list.style.display="none";
}
if (form1.rad_usertype[2].checked)
{
t_company.style.display="block";
}
else
{
t_company.style.display="none";
}
}
</script>
<?if($regsend==1){
if(trim($user_email)==""){$regerr="邮件地址必须填写";}
if(trim($gs_name)==""){$regerr="请输入您的公司名称!";}
if(trim($user_answer)==""){$regerr="密码提示答案必须填写";}
if(trim($user_question)==""){$regerr="密码提示问题必须填写";}
if(strlen(trim($user_pass))>12 ||strlen(trim($user_pass))<3){$regerr="密码必须在3-12位之间";}
if("'".$user_pass2."'" != "'".$user_pass."'"){$regerr="两次输入的密码不一样";}
if(trim($user_pass2)==""){$regerr="两遍密码都必须填写";}
if(trim($user_pass)==""){$regerr="密码必须填写";}
if(strlen(trim($user_namex))>16 ||strlen(trim($user_namex))<3){$regerr="用户名必须在3-12位之间";}
if(trim($user_namex)==""){$regerr="用户名必须填写";}
if($regerr==""){
$qustr="select count(*) as cou from member where user_name='$user_namex'";
$resultx = mysql_query("$qustr",$db);
$xcou=mysql_fetch_array($resultx);
$f_cou=$xcou["cou"];
if ($f_cou>0){
$regerr="该用户名已经登记,请重新选择用户名";
}else{
switch ($usertype) {
case 0:
srand((double)microtime()*1000000);
$randval = rand(10000,39999);
$qustr="INSERT INTO member VALUES('', '$user_namex','$user_pass',1, 1 ,CURDATE(),'$user_email', '$user_question', '$user_answer', '$user_mobile', 0,NULL,0, '$randval')";
$resultx = mysql_query("$qustr",$db);
$qustrd="select user_name,user_email from member where user_name='$user_namex'";
$resultd = mysql_query("$qustrd",$db);
if (mysql_num_rows($resultd) ==1) {
// $loginsend=1;
$username=$user_namex;
$password=$user_pass;
$mitem=1;
$mto=$user_email;
require "include/mail.php";
$regok=1;
}
else{
$regerr="用户注册不成功,数据库错误,请稍候再试";
}//end reg ok
break;
case 1:
$qustr_c="select count(*) as cou from member ";
$resultx_c = mysql_query("$qustr_c",$db);
$xcou_c=mysql_fetch_array($resultx_c);
$f_cou_c=$xcou_c["cou"]+1;
$qustr="INSERT INTO company VALUES('', '$f_cou_c','$gs_type1','$gs_type2', '$gs_class' ,'$gs_where','$gs_name', '$gs_compic', '$gs_addr', '$gs_zip', '$gs_man', '$gs_email', '$gs_tel', '$gs_fax', '$gs_web', '$gs_info', '$gs_goods', '$gs_goodspic', '-1','$cur_date');";
srand((double)microtime()*1000000);
$randval = rand(10000,39999);
$qustr="INSERT INTO member VALUES('', '$user_namex','$user_pass',1, 1 ,CURDATE(),'$user_email', '$user_question', '$user_answer', '$user_mobile', 0,NULL,0, '$randval')";
$qustrd="select user_name,user_email from member where user_name='$user_namex'";
$resultd = mysql_query("$qustrd",$db);
if (mysql_num_rows($resultd) ==1) {
// $loginsend=1;
$username=$user_namex;
$password=$user_pass;
$mitem=1;
$mto=$user_email;
require "include/mail.php";
$regok=1;
}
else{
$regerr="用户注册不成功,数据库错误,请稍候再试";
}
break;
}//switch
}//end no same user_name
}//end no regerr
}//end regsend?>
<
function Showlist()
{
if (form1.rad_usertype[0].checked)
{form1.usertype.value=0;}
else if (form1.rad_usertype[1].checked)
{form1.usertype.value=1;}
else if (form1.rad_usertype[2].checked)
{form1.usertype.value=2;}
if (form1.rad_usertype[1].checked)
{
t_list.style.display="block";
}
else
{
t_list.style.display="none";
}
if (form1.rad_usertype[2].checked)
{
t_company.style.display="block";
}
else
{
t_company.style.display="none";
}
}
</script>
<?if($regsend==1){
if(trim($user_email)==""){$regerr="邮件地址必须填写";}
if(trim($gs_name)==""){$regerr="请输入您的公司名称!";}
if(trim($user_answer)==""){$regerr="密码提示答案必须填写";}
if(trim($user_question)==""){$regerr="密码提示问题必须填写";}
if(strlen(trim($user_pass))>12 ||strlen(trim($user_pass))<3){$regerr="密码必须在3-12位之间";}
if("'".$user_pass2."'" != "'".$user_pass."'"){$regerr="两次输入的密码不一样";}
if(trim($user_pass2)==""){$regerr="两遍密码都必须填写";}
if(trim($user_pass)==""){$regerr="密码必须填写";}
if(strlen(trim($user_namex))>16 ||strlen(trim($user_namex))<3){$regerr="用户名必须在3-12位之间";}
if(trim($user_namex)==""){$regerr="用户名必须填写";}
if($regerr==""){
$qustr="select count(*) as cou from member where user_name='$user_namex'";
$resultx = mysql_query("$qustr",$db);
$xcou=mysql_fetch_array($resultx);
$f_cou=$xcou["cou"];
if ($f_cou>0){
$regerr="该用户名已经登记,请重新选择用户名";
}else{
switch ($usertype) {
case 0:
srand((double)microtime()*1000000);
$randval = rand(10000,39999);
$qustr="INSERT INTO member VALUES('', '$user_namex','$user_pass',1, 1 ,CURDATE(),'$user_email', '$user_question', '$user_answer', '$user_mobile', 0,NULL,0, '$randval')";
$resultx = mysql_query("$qustr",$db);
$qustrd="select user_name,user_email from member where user_name='$user_namex'";
$resultd = mysql_query("$qustrd",$db);
if (mysql_num_rows($resultd) ==1) {
// $loginsend=1;
$username=$user_namex;
$password=$user_pass;
$mitem=1;
$mto=$user_email;
require "include/mail.php";
$regok=1;
}
else{
$regerr="用户注册不成功,数据库错误,请稍候再试";
}//end reg ok
break;
case 1:
$qustr_c="select count(*) as cou from member ";
$resultx_c = mysql_query("$qustr_c",$db);
$xcou_c=mysql_fetch_array($resultx_c);
$f_cou_c=$xcou_c["cou"]+1;
$qustr="INSERT INTO company VALUES('', '$f_cou_c','$gs_type1','$gs_type2', '$gs_class' ,'$gs_where','$gs_name', '$gs_compic', '$gs_addr', '$gs_zip', '$gs_man', '$gs_email', '$gs_tel', '$gs_fax', '$gs_web', '$gs_info', '$gs_goods', '$gs_goodspic', '-1','$cur_date');";
srand((double)microtime()*1000000);
$randval = rand(10000,39999);
$qustr="INSERT INTO member VALUES('', '$user_namex','$user_pass',1, 1 ,CURDATE(),'$user_email', '$user_question', '$user_answer', '$user_mobile', 0,NULL,0, '$randval')";
$qustrd="select user_name,user_email from member where user_name='$user_namex'";
$resultd = mysql_query("$qustrd",$db);
if (mysql_num_rows($resultd) ==1) {
// $loginsend=1;
$username=$user_namex;
$password=$user_pass;
$mitem=1;
$mto=$user_email;
require "include/mail.php";
$regok=1;
}
else{
$regerr="用户注册不成功,数据库错误,请稍候再试";
}
break;
}//switch
}//end no same user_name
}//end no regerr
}//end regsend?>
<
<tr>
<td height="19"><img src="images/r9.gif" width="760" height="34"></td>
</tr>
<tr>
<td align="center" valign="top" background="images/r_bg3.gif">
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="16"><? echo $gs_name;echo $user_namex;?></td>
</tr>
</table>
<?
if($regok==1){
echo $execstr;
echo "sdfsfds";
echo "谢谢您的注册!<br><br>请从您注册的邮件地址收取您地帐号激活邮件<br><br>帐号10天内激活有效<br><br><br><br>";
}else{
?>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<form name="form1" method="post" action=""><tr>
<td bgcolor="#0000FF">
<table width="100%" height="396" border="0" cellpadding="1" cellspacing="1">
<?
echo "<tr align=center>\n";
echo "<td colspan=3><font color=red><b>".$regerr."</b></font></td>\n";
echo "</tr>\n";
?>
<tr align="center" bgcolor="#FCFED4">
<td width="14%" align="right">用户名称:</td>
<td width="36%" align="left">
<input name="user_namex" type="text" id="user_namex" value="<? echo $user_namex;?>" size="20" maxlength="16">
<font color=red>*</font></td>
<td width="50%" align="left"><font color=#99999>登陆时的名称,3-16位<? echo $usertype;?></font></td>
</tr>
<tr align="center" bgcolor="#FCFED4">
<td align="right">登陆密码:</td>
<td align="left">
<input name="user_pass" type="password" id="user_pass" value="<? echo $user_pass;?>" size="20" maxlength="12">
<font color=red>*</font></td>
<td align="left"><font color=#99999>每次登陆时的密码,3-12位</font></td>
</tr>
<tr align="center" bgcolor="#FCFED4">
<td align="right">重复密码:</td>
<td align="left">
<input name="user_pass2" type="password" id="user_pass2" value="<? echo $user_pass2;?>" size="20" maxlength="12">
<font color=red>*</font></td>
<td align="left"><font color=#99999>请重复输入上面的密码</font></td>
</tr>
<tr align="center" bgcolor="#FCFED4">
<td align="right">密码提问:</td>
<td align="left">
<input name="user_question" type="text" id="user_question" value="<? echo $user_question;?>" size="20">
<font color=red>*</font></td>
<td align="left"><font color=#99999>密码丢失时的提问,如"我的生日是多少?"</font></td>
</tr>
<tr align="center" bgcolor="#FCFED4">
<td align="right">问题答案:</td>
<td align="left">
<input name="user_answer" type="text" id="user_answer" value="<? echo $user_answer;?>" size="20" maxlength="30">
<font color=red>*</font></td>
<td align="left"><font color=#99999>上面问题的答案,如"2月14日"</font></td>
</tr>
<tr align="center" bgcolor="#FCFED4">
<td align="right">电子邮件:</td>
<td align="left">
<input name="user_email" type="text" id="user_email" value="<? echo $user_email;?>" size="20" maxlength="30">
<font color=red>*</font></td>
<td align="left" bgcolor="#FCFED4"><font color=#99999>您正常使用的电子邮件,以便与您联系</font></td>
</tr>
<tr align="center" bgcolor="#FCFED4">
<td align="right">手机号码:</td>
<td align="left">
<input name="user_mobile" type="text" id="user_mobile" value="<? echo $user_mobile;?>" size="20" maxlength="30"></td>
<td align="left"><font color=#99999>您的手机号码,用于不定期的抽奖活动等</font></td>
</tr>
<tr align="center" bgcolor="#FCFED4">
<td align="right">手机号码:</td>
<td align="left"><input type="radio" name="rad_usertype" onClick="Showlist()" checked>
普通会员 <font color="#0000FF"><strong>(免费注册)</strong></font></td>
<td align="left"><font color=#99999>您的手机号码,用于不定期的抽奖活动等</font></td>
</tr>
用$_POST[],来接收post的变量,用$_GET[]来接收get到的变量。