<%@language=vbscript codepage=936 %>
<%path="../basedata"%>
<!--#include file="../inc/function.asp"-->
<%call Loginpower%>
<%call Legalpower%>
<!--#include file="../conn/conn_admin.asp"-->
<%
'<!--#include file="md5.asp"-->
dim password1,password2,uid,rs,sqltext
password1=replace(trim(Request.form("pwd1")),"'","")
password2=replace(trim(Request.form("pwd2")),"'","")
uid=replace(trim(Request.form("uid")),"'","")
if password1<>password2 then
response.write errback("你输入两次密码有错，请重输入……")
response.end
end if
'---------------------------------------------------------start

set rs=server.createobject("adodb.recordset")
    sqltext="select * from admin where Admin_User='"&uid&"'"
    rs.open sqltext,conn_admin,1,3
if rs("Admin_User")<>uid then
	password=md5(md5(password1))
	rs.addnew                             '添加一个管理员帐号到数据库
	rs("Admin_User")=uid
	rs("Admin_Pass")=password
	rs("admin_create_time")=now()
	rs("Admin_flag")=session("masterflag")
	rs.update
	rs.close
	set rs=nothing
	conn_admin.close
	set conn_admin=nothing
	Response.Redirect "Manage_Admin.asp"
else
'查找数据库，检查此管理员是否已经存在
	rs.close
	set rs=nothing
	conn_admin.close
	set conn_admin=nothing
	Response.write errorback("此管理员帐号已经存在，请选用其它名称!")
end if
%>
