<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<!--#include virtual="/inc-freehost-function/FreeHostFunction.asp"-->
<%
If session("SqlAUID")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
ElseIf Request.Form ("id")="" Then
	ef=True
	ec="请输入产品ID！"
ElseIf Instr(1, Request.Form ("id"), "'", 1)>0 then
	ef=True
	ec="非法产品ID！"
ElseIf Instr(1, session("username"), "'", 1)>0 then
	ef=True
	ec="非法用户名！"
ElseIf Request.Form ("newpassword")="" Then
	ef=True
	ec="新密码为空！"
ElseIf Request.Form ("newpassword")<>Request.Form ("renewpassword") Then
	ef=True
	ec="密码不一致！"
ElseIf RegExpTest("[^A-Za-z0-9]",Request.Form ("newpassword")) Then
	ef=True
	ec="用户名中有非法字符！"
end if

if not ef then
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
	Set dsph = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_Sql where id='"&session("SqlAUID")&"'"
			if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
	dsph.Open Sql,conn,1,3
if dsph.Eof then
	ef=True
	ec="不存在的数据库ID！"
end if
end If

If not ef then
if not dsph("status")="正常" then
		ef=True
		ec="必须是处于正常状态的数据库才能管理！"
end if
end if

if not ef then
	Set dsserver = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_ServerSqllist where id='"&dsph ("ServerlistID")&"'"
	dsserver.Open Sql,conn,1,1
if dsserver.Eof then
	ef=True
	ec="服务器不存在！"
end if
end if

if not ef then
if lcase(trim(dsph("sqlname")))="sa" or lcase(trim(dsph("sqlname")))="freehost"  then
	ef=True
	ec="不允许修改此用户！"
end if
end if

if not ef then
URL=dsserver("site")
FreeHostsharekey=dsserver("FreeHostsharekey")
userid=dsserver ("admname")
pwd=dsserver("admpass")
sqlname=dsph("sqlname")
sqlpassword=dsph("sqlpassword")
%>

<!--#include virtual="/inc-freehost-function/template-sqladm-top.asp"-->
　修改数据库密码

<%

dim softtype,MySQLver,MSSQLver
softtype=dsserver("softtype")
MySQLver=dsserver("MySQLver")
MSSQLver=dsserver("MSSQLver")
sqlpassword=Request.Form ("newpassword")
'Response.Write 
temp=ResetSQLPassword(URL,FreeHostsharekey,userid,pwd,sqlname,sqlpassword)
dsph("sqlpassword")=sqlpassword
'response.write "新密码："&sqlpassword
dsph.update
dsph.close

%>
<br>
<br>　<br>　
保存成功。
<br>
<br>
　<a href="selfsqlmodify.asp?id=<%=Request("id")%>"><font color="#000000">[返回]</font></a>
<!--#include virtual="/inc-freehost-function/template-sqladm-end.asp"-->
<%end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>
