<%PageName="UserRegPost"%>
<!--#include file="conn.asp"-->
<!--#include file="function.asp"-->
<!--#include file="Star.INC"-->

<%if  request.Cookies("z")("z")<>"" and request.Cookies("z")("z")=request("t") then%>
<script>alert('请不要自己推荐自己，您也可以两天后再注册，谢谢！');history.back();</script>
<%end if  

if session("t")<>"" and request.Cookies("z")("z")=session("t") then %>

<script>alert('请不要自己推荐自己，您也可以两天后再注册，谢谢！');history.back();</script>


<%end if  



if session("t")<>"" then
t=session("t")
end if

if request("t")<>"" then
t=request("t")
end if


founderr=false
if request.form("green")=0 then
	response.redirect("index.asp")
	founderr=true
end if
if request.form("UserName")="" or len(request.form("UserName"))>20 then
%>
<script>alert('用户名输入错误(未输入或长度超过了20个字节)。');history.back();</script>
<%
	founderr=true
else
	UserName=trim(request.form("UserName"))
end if
if request.form("password")="" or Len(request.form("password"))>20 then
%>
<script>alert('请输入您的密码(长度不能大于20)。');history.back();</script>
<%
	founderr=true
else
	password=request.form("password")
end if

if password<>request("password2") then
%>
<script>alert('您输入的密码和确认密码不一致。');history.back();</script>
<%
	founderr=true
end if
 


if founderr=true then
	call error()
else
	set rs=server.createobject("adodb.recordset")
	sql="select * from [user2] where username='"&username&"'"
	rs.open sql,conn,1,3
	if not rs.eof or username=WebName then
%>
<script>alert('对不起，您输入的用户名已经被注册，请重新输入。');history.back();</script>
<%
		founderr=true
	else
		rs.addnew
		rs("username")=username
		rs("password")=password
		rs("t")=t
		rs("email")=email
		if request.form("Address")<>"" then rs("Address")=request.form("Address")
		if request.form("Tel")<>"" then rs("Tel")=request.form("Tel")
		if request.form("Sex")<>"" then rs("Sex")=request.form("Sex")
		if request.form("Youbian")<>"" then rs("Youbian")=request.form("Youbian")
		if request.form("Name")<>"" and request.form("Shenfenzheng")<>"" then
			rs("Name")=request("Name")
			rs("Shenfenzheng")=request("Shenfenzheng")
		end if
		rs("addDate")=NOW()
		rs.update
	
	
	Response.Cookies("z").Expires=Date+1
	Response.Cookies("z")("z") = 1
		
		
		
		
		
		
		
		
		
	end if
	rs.close
	if t<>"" then
	sql="update movie set hits=hits+1 where username='"&t&"'"
	set rs=server.createobject("adodb.recordset")
	sql="select * from [user2] where username='"&t&"'"
	rs.open sql,conn,1,3
	if not rs.eof then
	rs("tjrs")=rs("tjrs")+1
	rs.update
	end if
	rs.close
    end if
	
	if founderr=true then
		call error()
	else
%>
<!--#include file="top.asp"-->
<div align="center"> <center> 
  <table border="0" cellpadding="8" cellspacing="1" width="769">
    <tr align="center"> 
      <td colspan="2" bgcolor="#efdff7"><font color="#FF0000">注册成功</font></td>
    </tr>
    <form method=post action="ChkLogin.asp">
      <tr> 
        <td width="180" bgcolor="#efdff7" align="right">登录ID：</td>
        <td width="320" bgcolor="#efdff7">&nbsp; <input type=text name=username size=26 class=flat1 style="background-color: #efdff7; color: #ff0000; border: 0 solid #000000" value="<%=username%>"> 
          <input type=password name=password size=1 class=flat1 style="color: #efdff7; background-color: #efdff7; border: 0 solid #000000" value="<%=password%>"> 
        </td>
      </tr>
      <tr> 
        <td width="180" bgcolor="#f7efff" align="right">E-mail：</td>
        <td width="320" bgcolor="#f7efff">&nbsp;<%=Email%></td>
      </tr>
      <tr> 
        <td width="180" bgcolor="#efdff7" align="right">称呼：</td>
        <td width="320" bgcolor="#efdff7">&nbsp;<%=request.form("Sex")%></td>
      </tr>
      <tr> 
        <td width="180" bgcolor="#f7efff" align="right">真实姓名：</td>
        <td width="320" bgcolor="#f7efff">&nbsp; 
          <%if request.form("Name")="" then%>
          未填写 
          <%else%>
          <%=request.form("Name")%> 
          <%end if%>
        </td>
      </tr>
      <tr> 
        <td width="180" bgcolor="#efdff7" align="right">身份证号：</td>
        <td width="320" bgcolor="#efdff7">&nbsp; 
          <%if request.form("Shenfenzheng")="" then%>
          未填写 
          <%else%>
          <%=request.form("Shenfenzheng")%> 
          <%end if%>
        </td>
      </tr>
      <tr> 
        <td width="180" bgcolor="#f7efff" align="right">联系电话：</td>
        <td width="320" bgcolor="#f7efff">&nbsp; 
          <%if request.form("Tel")="" then%>
          未填写 
          <%else%>
          <%=request.form("Tel")%> 
          <%end if%>
        </td>
      </tr>
      <tr> 
        <td width="180" bgcolor="#efdff7" align="right">详细地址：</td>
        <td width="320" bgcolor="#efdff7">&nbsp; 
          <%if request.form("Address")="" then%>
          未填写 
          <%else%>
          <%=request.form("Address")%> 
          <%end if%>
        </td>
      </tr>
      <tr> 
        <td width="180" bgcolor="#f7efff" align="right">邮政编码：</td>
        <td width="320" bgcolor="#f7efff">&nbsp; 
          <%if request.form("Youbian")="" then%>
          未填写 
          <%else%>
          <%=request.form("Youbian")%> 
          <%end if%>
        </td>
      </tr>
      <tr bgcolor="#FFCCFF"> 
        <td width="500" colspan="2" align="center"> 
          <input value="现在登陆" name=Login type=submit>
        </td>
      </tr>
    </form>
  </table>
</div>
  
</div>       
<div align="center">        
  <center>
  </center>     
</div>        
<!--#include file="down.asp"-->                       
<%
end if
	set rs=nothing
end if
%>


