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


<%

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 IsValidEmail(trim(request.form("Email")))=false then
%>
<script>alert('您的Email有错误。');history.back();</script>
<%
	founderr=true
else
	Email=trim(request.form("Email"))
end if



if founderr=true then
	call error()
else
	set rs=server.createobject("adodb.recordset")
	sql="select * from [user] 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
		rs("kps")=0
		
		
		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+2
	Response.Cookies("z")("z") = username
		
		
		
		
		
		
		
		
		
	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 [user] 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" width="778" cellpadding="0" cellspacing="0" background="images/bg-content.gif">
        <tr>
          <td valign="top" width="14"><img border="0" src="images/clear.gif"></td>
          <td width="194" valign="top">
            <div align="center">
              <table border="0" cellpadding="0" cellspacing="5" width="100%">
                <tr>
                  <td width="100%">
                    <div align="center">
                      <table border="0" cellpadding="0" cellspacing="0" width="100%" background="images/a02.gif">
                        <tr>
                          <td width="100%" bgcolor="#EBEDEE"><img border="0" src="images/a01.gif"></td>
                        </tr>
                        <tr>
                          <td width="100%">
                            <table width=100% border=0 cellspacing=0 cellpadding=0>
        <form method=post action="ChkLogin.asp">
        <tr>
          <td width=80% height=130 align=center>用户名： 
            <input type=text name=username maxLength=20 size=12 class=inp>
            <br><br>
            密　码： 
            <input type=password name=password maxLength=20 size=12 class=inp>
            <br><br>
            <input type=image src=images/login.gif align=absMiddle border=0> 
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	    <a href=reg.asp><img src=images/reg.gif align=absMiddle border=0></a>
            </td>
        </tr>
        </form>
      </table></td>
                        </tr>
                        <tr>
                          <td width="100%" height="10" valign="bottom"><img border="0" src="images/a03.gif"></td>
                        </tr>
                        <tr>
                          <td width="100%" bgcolor="#EBEDEE" height="25" valign="bottom"><img border="0" src="images/a04.gif"></td>
                        </tr>
                        <tr>
                          <td width="100%">
                            <div align="center">
                              
                          <table border="0" cellpadding="6" cellspacing="0" width="100%">
                            <tr> 
                              <td align="center" colspan="2"><font color="#000000"><img border="0" src="images/aa.gif"></font> 
                                <font color="#993300">非会员免费试片区</font></td>
                            </tr>
                            <tr> 
                              <td width="50%" align="center"><font color="#000000"><img border="0" src="images/aa.gif">会员续费</font></td>
                              <td width="50%" align="center"><font color="#000000"><img border="0" src="images/aa.gif">会员注销</font></td>
                            </tr>
                            <tr> 
                              <td width="50%" align="center"><font color="#000000"><img border="0" src="images/aa.gif">帮助中心</font></td>
                              <td width="50%" align="center"><font color="#000000"><img border="0" src="images/aa.gif">忘记密码</font></td>
                            </tr>
                          </table>
                           </div>
                          </td>
                        </tr>
                        <tr>
                          <td width="100%" height="5" bgcolor="#EBEDEE"><img border="0" src="images/a03.gif"></td>
                        </tr>
                        <tr>
                          <td width="100%" bgcolor="#EBEDEE" height="25" valign="bottom"><img border="0" src="images/a05.gif"></td>
                        </tr>
                        <tr>
                          <td width="100%">
                        <table border="0" cellpadding="2" width="100%">
                      <%
                         sql="select id,name,hits from [movie]  order by hits desc"
                         Set rs= Server.CreateObject("ADODB.Recordset")
                         rs.open sql,conn,1,1
                         if rs.eof and rs.bof then
                            response.write "<p align='center'>没有任何电影</p>"
                         else
                         i=0
                         do while not rs.eof or rs.bof
                       %>
                          <TR> 
                            <td> 
                            <p align="center"><img border="0" src="images/list.gif"> 
                            <td width="118"><a href="list.asp?id=<%=rs("id")%>" target="_blank">
         <%
         if len(rs("name")) > 11 then
          response.write (left(rs("name"),9))
         else
          response.write (rs("name"))
         end if
         %>
    </a></TD>
                            <td width=30><p align="center"><%=rs("hits")%></td>
                          </TR>
                     <% i=i+1
                        if i>=15 then exit do
                        rs.movenext
                        loop
                        end if
                        rs.close
                        set rs=nothing
                     %>

                        </table>
</td>
</tr>
<tr><td width="100%" bgcolor="#EBEDEE"><img border="0" src="images/a03.gif"></td>
</tr></table></div></td>
</tr>
              </table>
            </div>
          </td>
          <td width="7">　</td>
          <td valign="top" width="550">
            
        <div align="center"> 
          <table border="0" cellpadding="0" cellspacing="7" width="100%">
                <tr>
                  <td width="100%">
                  <div align="center">
                    
                  <table border="0" cellpadding="0" cellspacing="0" width="538" background="images/b01.gif" height=400>
                    <tr> 
                      <td width="100%" bgcolor="#EBEDEE" colspan="4"><img border="0" src="images/b.gif"></td>
                    </tr>
                  <tr>
                  <td width="100%"> 
                    <div align="center"> 
                      <table border="0" cellpadding="8" cellspacing="1" width="502">
                        <tr align="center"> 
                          <td colspan="2" bgcolor="#9FD6F8"><font color="#FF0000">注册成功</font></td>
                        </tr>
                        <form method=post action="ChkLogin.asp">
                          <tr> 
                            <td width="180" bgcolor="#9FD6F8" align="right">登录ID：</td>
                            <td width="320" bgcolor="#9FD6F8">&nbsp; 
                              <input type=text name=username size=26 class=flat1 style="background-color: #9FD6F8; color: #ff0000; border: 0 solid #000000" value="<%=username%>">
                              <input type=password name=password size=1 class=flat1 style="color: #9FD6F8; background-color: #9FD6F8; border: 0 solid #000000" value="<%=password%>">
                            </td>
                          </tr>
                          <tr> 
                            <td width="180" bgcolor="#b4def8" align="right">E-mail：</td>
                            <td width="320" bgcolor="#b4def8">&nbsp;<%=Email%></td>
                          </tr>
                          <tr> 
                            <td width="180" bgcolor="#9FD6F8" align="right">称呼：</td>
                            <td width="320" bgcolor="#9FD6F8">&nbsp;<%=request.form("Sex")%></td>
                          </tr>
                          <tr> 
                            <td width="180" bgcolor="#b4def8" align="right">真实姓名：</td>
                            <td width="320" bgcolor="#b4def8">&nbsp; 
                              <%if request.form("Name")="" then%>
                              未填写 
                              <%else%>
                              <%=request.form("Name")%> 
                              <%end if%>
                            </td>
                          </tr>
                          <tr> 
                            <td width="180" bgcolor="#9FD6F8" align="right">身份证号：</td>
                            <td width="320" bgcolor="#9FD6F8">&nbsp; 
                              <%if request.form("Shenfenzheng")="" then%>
                              未填写 
                              <%else%>
                              <%=request.form("Shenfenzheng")%> 
                              <%end if%>
                            </td>
                          </tr>
                          <tr> 
                            <td width="180" bgcolor="#b4def8" align="right">联系电话：</td>
                            <td width="320" bgcolor="#b4def8">&nbsp; 
                              <%if request.form("Tel")="" then%>
                              未填写 
                              <%else%>
                              <%=request.form("Tel")%> 
                              <%end if%>
                            </td>
                          </tr>
                          <tr> 
                            <td width="180" bgcolor="#9FD6F8" align="right">详细地址：</td>
                            <td width="320" bgcolor="#9FD6F8">&nbsp; 
                              <%if request.form("Address")="" then%>
                              未填写 
                              <%else%>
                              <%=request.form("Address")%> 
                              <%end if%>
                            </td>
                          </tr>
                          <tr> 
                            <td width="180" bgcolor="#b4def8" align="right">邮政编码：</td>
                            <td width="320" bgcolor="#b4def8">&nbsp; 
                              <%if request.form("Youbian")="" then%>
                              未填写 
                              <%else%>
                              <%=request.form("Youbian")%> 
                              <%end if%>
                            </td>
                          </tr>
                          <tr> 
                            <td width="500" bgcolor="#67BDF1" align="center" colspan="2"> 
                              <input value="现在登陆" name=Login type=submit>
                            </td>
                          </tr>
                        </form>
                      </table>
                </td>
                </tr>
                <tr><td colspan="4"><img src=images/b02.gif width=537 border=0></td></tr>
              </table>
                  </td>
                </tr>
                
              </table>
            </div>
          </td>
          <td valign="top" width="13"><img border="0" src="images/clear1.gif"></td>
        </tr>
      </table>
    </div>
  
</div>       
<div align="center">        
  <center>
  </center>     
</div>        
<!--#include file="down.asp"-->                       
<%
end if
	set rs=nothing
end if
conn.close
set conn=nothing
%>


