<%@ codepage ="936" %>
 <% 
	data_path="../../" 'ACC连接数据库路径，对SQL无效
	numid="no"
	dir="no" 
  %> 
 <!--#include file="../../conn/conn.asp"-->
<!--#include file="../../inc/safe.asp"-->
<!--#include file="../../inc/filesystem.asp"-->
 <!--#include file="../rolecheck.asp"-->

<%
if Not ChkPost then 
response.redirect ("/login/chklogin.asp?login=4")
response.end
end if

 id=Replace_Text(request("id"))
 username=Replace_Text(request.form("username"))
  
if username<>"" then 
set rsc=server.CreateObject("adodb.recordset")
sqlc="select id from Websen_corporation where [user]='"&username&"' and  id<>"&id
  rsc.open sqlc,conn,1,1
if not rsc.eof then 
response.Write("<script>alert('对不起！该会员登录名已经存在，请另换一个！ ');history.back(-1);</script>")
response.End()
rsc.close
end if
else
 response.Write("<script >alert('请输入登录名！');history.back(-1);</script>")
 response.End()
end if
pass=Replace_Text(request.form("pass"))
gradeid=Replace_Text(request.form("gradeid"))
name1=Replace_Text(request.form("name"))
mark=Replace_Text(request.form("mark"))
ch=Replace_Text(request.form("ch"))
email=Replace_Text(request.form("email"))
phonecountry=Replace_Text(request.form("phonecountry"))
phonearea=Replace_Text(request.form("phonearea"))
phonenumber=Replace_Text(request.form("phonenumber"))
phone=phonecountry&"&nbsp;"&phonearea&"&nbsp;"&phonenumber
faxcountry=Replace_Text(request.form("faxcountry"))
faxarea=Replace_Text(request.form("faxarea"))
faxnumber=Replace_Text(request.form("faxnumber"))
fax=faxcountry&"&nbsp;"&faxarea&"&nbsp;"&faxnumber
mobile=Replace_Text(request.form("mobile"))
post=Replace_Text(request.form("post"))
country=Replace_Text(request.form("country1"))
sf=Replace_Text(request.form("province"))
city=Replace_Text(request.form("city"))
address=Replace_Text(request.form("address"))
qymc=Replace_Text(request.form("qymc"))
zw=Replace_Text(request.form("zw"))
categoryid=Replace_Text(request.form("categoryid"))
msn=Replace_Text(request.form("msn"))
begindate=Replace_Text(request.form("Begintime"))

enddate=Replace_Text(request.form("EndTime"))
 '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'处理种类的id号 
sortid=Replace_Text(request("p_z_Z_RootCategory"))                                   '第一类
CategoryId=split(Replace_Text(request("p_z_Z_CategoryId1")),",")

typeid=CategoryId(0)                                                                 '第二类

 if ubound(CategoryId)>=1 then
typeid_2=CategoryId(1)                                                               '第三类     
	else
typeid_2=0
	end if
	
	if typeid="" then
    typeid=0
	end if
	if typeid_2="" then
    typeid_2=0
	end if
  
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   web=Replace_Text(request.form("web"))

p_z_Z_productionService=Replace_Text(request.form("p_z_Z_productionService"))
qylb=Replace_Text(request.form("qylb"))
frdb=Replace_Text(request.form("frdb"))
qyjj=Replace_Text(request.form("qyjj"))

isournotify=Replace_Text(request.form("isournotify"))
if isournotify="" then
isournotify=0
else
isournotify=1
end if
isothernotify=Replace_Text(request.form("isothernotify"))
if isothernotify="" then
isothernotify=0
else
isothernotify=1
end if

'取出该会员的原有的登录名称--------------
oldusername="0"
 
'删除由于转换等级造成的有无企业模板的删除问题---------------- 

set rsde=server.CreateObject("adodb.recordset")
sqlde="select  [user],gradeid from  Websen_corporation where id="&id&""
rsde.open sqlde,conn,1,1
if not rsde.eof then
oldusername=rsuo("user")
oldgradeid=rsde("gradeid")
if oldgradeid<>gradeid then
 '新等级是否允许使用企业模板（如果不，则删除原有的生成了的模板页）----------------
isnew=0
set rsnd=server.CreateObject("adodb.recordset")
sqlnd="select rolelist from  Websen_vipgrade where roleid="&gradeid
rsnd.open sqlnd,conn,1,1
if not rsnd.eof then
if instr(rsnd("rolelist"),"qw")>0 then
isnew=1
end if
rsnd.close
end if
'-----------------

if isnew=0 then
'旧等级是否允许使用企业模板并且该模板页面已经生成存在,如果满足就删除--------------------
 set rso=server.CreateObject("adodb.recordset")
sqlo="select rolelist from Websen_vipgrade where roleid="&oldgradeid
rso.open sqlo,conn,1,1
if not rso.eof then
if instr(rso("rolelist"),"qw")>0 then
   set fso=YXFSO
    upath=Server.MapPath(HOPE_InstallDir&"vipcom/"&username) 
  	If fso.FolderExists(upath) Then 
	 	set folder = fso.GetFolder(upath) 
	   for each items in folder.Files 
	   url = items
   	   if fso.FileExists(url) then 
	   if right("ok"&url,3)="htm" then 
 		  fso.DeleteFile url,true  
	   end if
   	   end if 
       next 
   	End if
    set fso=nothing 
end if
rso.close
end if

'------------------------
end if

end if

rsde.close
end if


'------------------------------------------------------------

set rs=server.CreateObject ("adodb.recordset")
sql="select * from Websen_corporation where id="&id&""
rs.open sql,conn,1,3
rs("user")=username
rs("pass")=pass
rs("name")=name1
rs("ch")=ch
rs("email")=email
rs("phone")=phone
rs("fax")=fax
rs("mobile")=mobile
rs("post")=post
rs("country")=country
rs("sf")=sf
rs("city")=city
rs("address")=address
rs("qymc")=qymc
rs("zw")=zw
rs("sortid")=sortid
rs("typeid")=typeid
rs("typeid_2")=typeid_2
rs("web")=web
rs("msn")=msn
rs("zycp")=p_z_Z_productionService
rs("qylb")=qylb
rs("frdb")=frdb
rs("qyjj")=qyjj
rs("gradeid")=gradeid
rs("begindate")=begindate
rs("enddate")=enddate
if markct then
rs("mark")=mark
end if
 rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
 <title>操作成功</title>
<link rel="stylesheet" type="text/css" href="../css/style.css">
 </head>

<table cellpadding=2 cellspacing=1 border=0 width=400 class=tableBorder align=center><TR>
  <TH class=tableHeaderText colSpan=2 height=25>修改会员资料信息</TH>
<TR><tr><td height=85 valign=top class=forumRow><div align=center><br><br>
会员资料修改成功！</div></td></tr><tr align=center><td height=30 class=forumRowHighlight><a href='useredit.asp?id=<%=id%>'>&lt;&lt; 返回上一页</a></td></tr></table>
</body>
</html>