<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../conn/conn.asp"-->
<!--#include file="../inc/Commoncode.asp"-->
<!--#include file="../inc/CommonFunction.asp"-->
<!--#include file="../inc/md5.asp"-->
<!--#include file="../API/API_Config.asp"-->
<!--#include file="../API/API_Function.asp"-->
<%link="person_pwd.asp"%>
<!--#include file="checkpmember.asp" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>个人会员中心--<%=SiteTitle%></title>
<script src="../js/main.js" language="javascript"></script>
<link href="../member/css.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/input.js"></script>
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
</head>
<body>
<div class="memmenul">

<%step=trim(request("step"))
Select Case step
	Case "Modifypwd"
		Call ShowpwdData()
	Case "Modifyname"
		If API_Enable Then
			response.write("<script language=JavaScript>{alert('启用整合，此项禁止修改！');location.href = 'person_pwd.asp';}</script>")
			response.end
		else
			Call ShownameData()
		end if
	Case "NameOk"
		Call SavenameData()
	Case "PwdOk"
		Call SavepwdData()
	Case Else
		Call main()
End Select%>
<%Sub main()%>
<div class="leftmenutit"><span>修改帐户信息</span></div>
<%
set rs=server.createobject("ADODB.Recordset")
sql="select member_login,member_name,member_email from job_member where member_login='"&pmember_login&"'"
rs.open sql,conn,1,1
%>
<table width="98%" border="0" cellspacing="0" cellpadding="0" class="mtable" align="center">
  <tr>
    <td>用 户 名： <%=rs("member_login")%> <a href="person_pwd.asp?step=Modifyname">修改用户名</a></td>
  </tr>
  <tr>
    <td>密&nbsp;&nbsp;&nbsp;&nbsp;码： <a href="person_pwd.asp?step=Modifypwd">修改密码</a></td>
  </tr>
  <tr>
    <td>姓&nbsp;&nbsp;&nbsp;&nbsp;名： <%=rs("member_name")%></td>
  </tr>
  <tr>
    <td>电子邮件： <%=rs("member_email")%> (若需修改，请到 <a href="person_email.asp">修改邮箱</a> 修改。)</td>
  </tr>
</table>
<%
rs.close
set rs=nothing
%>
<%End Sub
Sub ShowpwdData()%>
<div class="leftmenutit"><span>修改密码</span></div>
<table width="98%" border="0" cellspacing="0" cellpadding="0" class="mtable">
<form name="form1" action="person_pwd.asp?step=PwdOk" method="post" onSubmit="return pwdmodi()">
  <tr>
    <td width="13%" align="right">旧&nbsp; 密&nbsp; 码:</td>
    <td width="87%"><INPUT name="oldpwd" type="password" id="oldpwd" maxLength="20"></td>
  </tr>
  <tr>
    <td align="right">新&nbsp; 密&nbsp; 码:</td>
    <td><INPUT name="pwd" type="password" id="pwd"  maxLength=20></td>
  </tr>
  <tr>
    <td align="right">确认新密码:</td>
    <td><INPUT name="repwd" type="password" id="repwd"  maxLength=20></td>
  </tr>
  <tr>
    <td colspan="2"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name="Submit" type="submit" class="inputs"  value="修 改">　
      <input name="Submit2" type="button" class="inputs" onClick="window.history.back();" value="返　回"></td>
    </tr>
  <tr>
    <td colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="STYLE1">注：4-20个字母或数字组成，区分大小写。</span></td>
    </tr>
  </form>
</table>
<%End Sub
Sub ShownameData()%>
<div class="leftmenutit"><span>修改用户名</span></div>
<table width="98%" border="0" cellspacing="0" cellpadding="0" class="mtable">
<form name="form1" action="person_pwd.asp?step=NameOk" method="post" onSubmit="return loginmodi()">
  <tr>
    <td width="11%" align="right">旧 帐 号:</td>
    <td width="89%"><input name=oldlogin id="oldlogin" value="<%=pmember_login%>" maxlength=20 readonly></td>
  </tr>
  <tr>
    <td align="right">新 帐 号:</td>
    <td><input id=login  maxlength=20 name=login onBlur="return checkLogins();"><span id="logins"></span></td>
  </tr>
  <tr>
    <td colspan="2"> &nbsp;
      &nbsp;&nbsp;&nbsp;&nbsp; <input name="Submit" type="submit" class="inputs" value="修 改">　
  <input name="Submit1" type="button" class="inputs" id="Submit1" value="返　回" onClick=window.history.back();></td>
    </tr>
  <tr>
    <td colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="STYLE1"> 注：4-20个字母或数字组成，不区分大小写。</span></td>
    </tr>
  </form>
</table>
<%End Sub%>
</div>
<%
conn.close:set conn=nothing%>
<%Sub SavenameData()
login=Replace(request("login"),"'","")
set rs=server.createobject("adodb.recordset")
sql="select member_login from JOB_member where member_login='"&login&"'"
rs.open sql,conn,1,1  
	if not rs.eof then
	rs.close
	set rs=nothing
	response.write("<script language=JavaScript>{alert('该帐号已经有人使用了！');location.href = 'javascript:history.back()';}</script>")
	Response.End()
	else
	   conn.execute("update job_p_myfavorite set myfavorite_pmember='"&login&"' where myfavorite_pmember='"&pmember_login&"'")
	   conn.execute("update job_p_myinterview set myinterview_pmember='"&login&"' where myinterview_pmember='"&pmember_login&"'")
	   conn.execute("update job_p_mysend set mysend_pmember='"&login&"' where mysend_pmember='"&pmember_login&"'")
	   conn.execute("update job_p_education set education_pmember='"&login&"' where education_pmember='"&pmember_login&"'")
	   conn.execute("update job_p_training set train_pmember='"&login&"' where train_pmember='"&pmember_login&"'")
	   conn.execute("update job_p_lang set lang_pmember='"&login&"' where lang_pmember='"&pmember_login&"'")
	   conn.execute("update job_p_work set work_pmember='"&login&"' where work_pmember='"&pmember_login&"'")
	   conn.execute("update JOB_picture set picture_member='"&login&"' where picture_member='"&pmember_login&"'")
	   conn.execute("update job_p_letter set letter_pmember='"&login&"' where letter_pmember='"&pmember_login&"'")
	   conn.execute("update job_p_resume set resume_pmember='"&login&"' where resume_pmember='"&pmember_login&"'")
	   conn.execute("update job_Member set member_login='"&login&"' where member_login='"&pmember_login&"'")
	   Response.Cookies(FRHRCMS)("user_login")=login
	end if
rs.close
set rs=nothing
response.write("<script language=JavaScript>{alert('恭喜您，修改成功！');location.href = 'person_pwd.asp';}</script>")
response.end
End Sub
Sub SavepwdData()
pmember_oldpwd=MD5(trim(Request("oldpwd")),32)
set rs=server.createobject("ADODB.Recordset")
sql="select * from job_member where member_login='"&pmember_login&"'"
rs.open sql,conn,3,3
	if pmember_oldpwd<>rs("member_pwd") then
	  rs.close
	  set rs=nothing
	  response.write "<script language=javascript>alert('旧密码错误！请重新输入。');location.href='javascript:history.back()';</script>"
	  response.end 
	else
	  rs("member_pwd")=MD5(trim(request("pwd")),32)
	  rs.update
	  rs.close
	  set rs=nothing
	  Response.Cookies(FRHRCMS)("user_pass")=MD5(trim(request("pwd")),32)
	end if 
'添加对整合接口的支持
If API_Enable Then
	'重置错误状态和信息
	FoundErr = False
	ErrMsg = ""
	set sMyXmlHTTP=server.createobject("MSXML2.ServerXMLHTTP")
	sMyXmlHTTP.setTimeouts API_Timeout, API_Timeout, API_Timeout * 6, API_Timeout * 6
	For intIndex = 0 To UBound(ArrUrls)
	sMyXmlHTTP.open "POST",ArrUrls(intIndex),false
	sMyXmlHTTP.setRequestHeader "Content-Type", "text/xml; charset=gb2312"
	sMyXmlHTTP.Send "<root><appid>finereason</appid><action>update</action><syskey>"&MD5(pmember_login & API_SysKey, 16)&"</syskey><username>"&pmember_login&"</username><password>"&trim(request("pwd"))&"</password><email></email><question></question><answer></answer></root>"
	If sMyXmlHTTP.readyState = 4 And sMyXmlHTTP.Status = 200 Then
		Dim objRecXml
		Set objRecXml = Server.CreateObject("Microsoft.XMLDOM")
		objRecXml.Async = False
		objRecXml.Load (sMyXmlHTTP.ResponseXML)
		If objRecXml.documentElement.selectSingleNode("//status").Text <> "0" Then
			FoundErr = True
			ErrMsg = objRecXml.documentElement.selectSingleNode("//message").Text & " [APIError-API-" & intIndex & "]"
		End If
	End If
	If FoundErr Then
		call Show_Err()
		Exit For
	End If
	Next
End If
response.write("<script language=JavaScript>{alert('恭喜您，修改成功！');location.href = 'person_pwd.asp';}</script>")
response.end
End Sub
%>