<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
If session("admau")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
elseIf session("canadmuser")="" Then
	ef=True
	ec="您没有此操作的权限。"
ElseIf RegExpTest("[^A-Za-z0-9]",Request.Form ("username")) Then
	ef=True
	ec="用户名中有非法字符！"
ElseIf RegExpTest("[^A-Za-z0-9]",Request.Form ("newusername")) Then
	ef=True
	ec="用户名中有非法字符！"
end if

if not ef then
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
	Set dsnew = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_USER where username='"&request.Form ("newusername")&"'"
		dsnew.Open Sql,conn,1,1
if dsnew.eof then
	ef=True
	ec="新用户不存在!"
end if
end if

if not ef then
	Set ds = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_USER where username='"&request.Form ("username")&"'"
		ds.Open Sql,conn,1,1
if ds.eof then
	ef=True
	ec="原用户不存在!"
end if
end if

if not ef then


Set dsph = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_Host where username='"&ds("username")&"'"
	dsph.Open Sql,conn,1,3
while not dsph.Eof
	dsph("username")=Request.Form ("newusername")
	dsph("agent1")=dsnew("agent1")
	dsph.update
	dsph.movenext
wend
dsph.close
set dsph=nothing



Set dsph = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_ALLEmail where username='"&ds("username")&"'"
	dsph.Open Sql,conn,1,3
while not dsph.Eof
	dsph("username")=Request.Form ("newusername")
	dsph("agent1")=dsnew("agent1")
	dsph.update
	dsph.movenext
wend
dsph.close
set dsph=Nothing


Set dsph = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_Email where username='"&ds("username")&"'"
	dsph.Open Sql,conn,1,3
while not dsph.Eof
	dsph("username")=Request.Form ("newusername")
	dsph("agent1")=dsnew("agent1")
	dsph.update
	dsph.movenext
wend
dsph.close
set dsph=nothing


Set dsph = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_Sql where username='"&ds("username")&"'"
	dsph.Open Sql,conn,1,3
while not dsph.Eof
	dsph("username")=Request.Form ("newusername")
	dsph("agent1")=dsnew("agent1")
	dsph.update
	dsph.movenext
wend
dsph.close
set dsph=nothing


Set dsph = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_Domain where username='"&ds("username")&"'"
	dsph.Open Sql,conn,1,3
while not dsph.Eof
	dsph("username")=Request.Form ("newusername")
	dsph("agent1")=dsnew("agent1")
	dsph.update
	dsph.movenext
wend
dsph.close
set dsph=nothing

Set dsph = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Preopen_Product where username='"&ds("username")&"'"
	dsph.Open Sql,conn,1,3
while not dsph.Eof
	dsph("username")=Request.Form ("newusername")
	dsph("agent1")=dsnew("agent1")
	dsph.update
	dsph.movenext
wend
dsph.close
set dsph=nothing


Set dsph = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_Other where username='"&ds("username")&"'"
	dsph.Open Sql,conn,1,3
while not dsph.Eof
	dsph("username")=Request.Form ("newusername")
	dsph("agent1")=dsnew("agent1")
	dsph.update
	dsph.movenext
wend
dsph.close
set dsph=Nothing

Set dsph = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_vps where username='"&ds("username")&"'"
	dsph.Open Sql,conn,1,3
while not dsph.Eof
	dsph("username")=Request.Form ("newusername")
	dsph("agent1")=dsnew("agent1")
	dsph.update
	dsph.movenext
wend
dsph.close
set dsph=nothing

FreeHost_oplog session("admusername"),"成功",Request.Form ("username")&" 的产品变更另一用户名下："&Request.Form ("newusername")

%>
修改成功
<br><br>
操作完成。
<%end if

if ef then%>
<%=ec%>
<%end if%>
<script>
var partable=parent.document.getElementById("table0");
if (partable!=null)
partable.style.display='';

partable=parent.document.getElementById("outconM");
if (partable!=null)
partable.innerHTML = document.body.innerHTML;
</script>