<%@ Language=VBScript %>
<!--#include virtual="/inc/FreeHost-AG-Function.asp"-->
<%title="用户注册"%>
<%
If session("agentname")<>Trim(LCase(Application("agentname"))) And session("agentname")<>"" And session("agentname")<>"n" Then ret=GETOP("/api/sendvar.asp","var=agentname&agentname="&Trim(LCase(session("agentname"))))
If session("agentname")=Trim(LCase(Application("agentname"))) or session("agentname")="" or session("agentname")="n" Then ret=GETOP("/api/sendvar.asp","var=agentname&agentname="&Trim(LCase(Application("agentname"))))

Function CLen(HzStr)
L = len(HzStr)
For n=1 to L
If Asc(mid( HzStr,n,1))<0 Then HzNum = HzNum + 1
Next
Clen = L + HzNum
End Function
for each item in Request.Form
if instr(Request.Form(item),"'")>0 then response.Redirect "e.asp?e=出错，请不要输入'字符："&Request.Form(item) 
if instr(Request.Form(item),"&")>0 then response.Redirect "e.asp?e=出错，请不要输入&字符："&Request.Form(item) 
if CLen(Request.Form(item))>50 then response.Redirect "e.asp?e=出错，请不要输入超出50个字母或25个汉字："&Request.Form(item)&" 字数为："&CLen(Request.Form(item))
next

If Request.Form ("username")="" or RegExpTest("[^A-Za-z0-9]",Request.Form ("username")) or len(Trim(Request.Form ("username")))<3 Then
	ef=True
	ec="会员名没有写/或会员名中有非法字符/或会员名长度小于3个字符！"
ElseIf session("admau")="" and  session("agentusername")="" and (Request.Form ("Vcode")<>session("Vcode") or session("Vcode")="") Then
	ef=True
	ec="验证码不正确！"
'ElseIf Lcase(trim(Request.Form ("username")))="freehost" Then
'	ef=True
'	ec="系统保留的用户名不能申请！"
ElseIf Request.Form ("password")=""  or len(Request.Form ("password"))<6 Then
	ef=True
	ec="密码没填/或密码长度小于6个字符！"
ElseIf session("admau")="" and session("agentusername")="" and Request.Form ("password")<>Request.Form ("repassword") Then
	ef=True
	ec="重复输入的密码不一致！"
ElseIf len(Request.Form ("postid"))>7 Then
	ef=True
	ec="邮编出错！"
ElseIf len(Request.Form ("truename"))<2 or RegExpTest("[A-Za-z0-9]",Request.Form ("truename")) Then
	ef=True
	ec="请提供准确的姓名！"
ElseIf RegExpTest("[^\u4e00-\u9fa5]",Request("truename")) Then
	ef=True
	ec="姓名中有非法字符！"
ElseIf Request.Form ("address")<>"" And len(Request.Form ("address"))<5 Then
	ef=True
	ec="请提供准确的地址！"
ElseIf len(Request.Form ("tel"))<5 Then
	ef=True
	ec="请提供准确的电话号码！"
ElseIf Request.Form ("mobi")<>"" And (len(Request.Form ("mobi"))<>11 Or  not IsNumeric(Request("mobi"))) Then
	ef=True
	ec="请提供准确的手机号码！"
elseif Trim(Request("email"))="" or RegExpTest("^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$",Request("email"))=false then
	ef=True
	ec="邮箱不正确！"
end if

if Application("hpsystem")=true then
if IDCheck(Lcase(Request.Form ("perid")))=false then
	ef=True
	ec="请提供准确的身份证地址！"
ElseIf right(Request.Form ("address"),1)="市" or right(Request.Form ("address"),1)="县" or right(Request.Form ("address"),1)="镇"  or right(Request.Form ("address"),1)="乡" or right(Request.Form ("address"),1)="街" or right(Request.Form ("address"),1)="庄"  or right(Request.Form ("address"),1)="区" or right(Request.Form ("address"),1)="区" or right(Request.Form ("address"),1)="路" or right(Request.Form ("address"),2)="大学" or right(Request.Form ("address"),2)="学院" or right(Request.Form ("address"),2)="中学" or right(Request.Form ("address"),2)="小学" or right(Request.Form ("address"),2)="中专"  or right(Request.Form ("address"),2)="学校" Then
	ef=True
	ec="必须提供详细准确的地址才可以申请，例如必须详细到多少号或多少年级！"
ElseIf len(Request.Form ("city"))<2 or RegExpTest("[A-Za-z0-9]",Request.Form ("city")) Then
	ef=True
	ec="请提供准确的城市资料！"
end if
end If

If not ef then
APIret=POSTOP("/user/register-sub.asp",Request.form)
If InStr(APIret,title) Then
APIret=mid(APIret,InStr(APIret,title)+Len(title))
End if
end If

If not ef then%>
<!--#include virtual="/user/user-moban.asp"-->
<%end If

if ef then
Response.Redirect "e.asp?e="&ec
end if
%>