<%If request("var")="NetPaypercent" Then response.write Application("NetPaypercent")
If request("var")="CPSite" Then response.write Application("ctldomain")
If request("var")="APISite" Then response.write Application("apipubdomain")
If request("var")="usercanselectapi" Then response.write Application("usercanselectapi")
If request("var")="api1" Then response.write Application("api1")
If request("var")="api2" Then response.write Application("api2")
If request("var")="api3" Then response.write Application("api3")
If request("var")="api4" Then response.write Application("api4")
If request("var")="api5" Then response.write Application("api5")
If request("var")="api6" Then response.write Application("api6")
If request("var")="api7" Then response.write Application("api7")

If request("var")="agentname" Then
'检查有没有这个代理

If Request("agentname")<>"" and RegExpTest("[A-Za-z0-9]",Request ("agentname")) Then

If RegExpTest("[^A-Za-z0-9]",Request("agentname")) Then
response.write "thisagentnotexist"
response.end
End If

'response.write Request("agentname")

Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
  Set dsreg = Server.CreateObject("ADODB.Recordset")	
		Sql="Select username,canuseapi from FreeHost.FreeHost_AGENT where username='"&Request("agentname")&"'"
		dsreg.Open Sql,conn,1,1
If Not dsreg.Eof Then
If dsreg("canuseapi")=true then
If session("agentname")="n" Or session("agentname")="" or session("agentname")=lcase(dsreg("username")) Then
session("agentname")=dsreg("username")
response.write session("agentname")
Else
response.write "errorsetagentname"
End if
Else
response.write "canuseapiisfalse"
end If
Else
response.write "thisagentnotexist"
End if
dsreg.close
Set dsreg=nothing
conn.close
Set conn=nothing
end If'合法的代理名
End if'完成检查代理


Function RegExpTest(patrn, strng)
  Dim regEx
  Set regEx = New RegExp
  regEx.Pattern = patrn
  regEx.IgnoreCase = False
  RegExpTest = regEx.Test(strng)
End Function 
%>