<!--#include file="../conn.asp" -->
<%
''*******************************************************************************
''************函数功能：去掉函数参数中的HTML标记*********************************
''*******************************************************************************
Function stripHTML(strtext)
dim arysplit,i,j, strOutput

arysplit=split(strtext,"<")
if len(arysplit(0))>0 then j=1 else j=0
for i=j to ubound(arysplit)
  if instr(arysplit(i),">") then
   arysplit(i)=mid(arysplit(i),instr(arysplit(i),">")+1)
  else
   arysplit(i)="<" & arysplit(i)
  end if
next

strOutput = join(arysplit, "")
strOutput = mid(strOutput, 2-j)
strOutput = replace(strOutput,">",">")
strOutput = replace(strOutput,"<","<")

stripHTML = strOutput
End Function
''*******************************************************************************
''**应用方法：StripHTML("string")，其中，string为要去掉HTML标记的字符串**********
''*******************************************************************************
%>
<%
if session("username")="" then
response.Redirect("merr.asp?action=err")
response.End()
else
username=session("username")
userid=session("userid")
end if
%>
<%
userid=session("userid")
set rs=server.CreateObject("adodb.Recordset")
sql2="select * from diaryuser where userid="&userid&""
Rs.Open Sql2,conn,1,1
username=rs("username")
password3=rs("password")
sex=rs("sex")
image=rs("image")
url=rs("url")
qq=rs("qq")
rs.close
image1=image
if image="k" then
image="01.gif"
end if
if sex="girl" then
image="face/g"+image
else
image="face/b"+image
end if

if Trim(Request.QueryString("action"))="edit" then
username=session("username")
password=Trim(Request.Form("password"))
sex=Trim(Request.Form("sex"))
image=Trim(Request.Form("image"))
url=Trim(Request.Form("url"))
qq=Trim(Request.Form("qq"))
'url=stripHTML(url)
'qq=stripHTML(qq)
set rs99=server.CreateObject("adodb.recordset")
sql99="select * from diaryuser where userid="&userid
rs99.open sql99,conn,1,3
rs99("password")=password
rs99("sex")=sex
rs99("image")=image
rs99("url")=url
rs99("qq")=qq
rs99.update
rs99.close
set rs99=nothing
response.Redirect("mroleset.asp?userid="&userid)
end if
%>
<html>
<head>
<title>角色属性设定</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<link href="../diary/css.css" rel="stylesheet" type="text/css">
<script src="img/alt.js"></script>

<script language="JavaScript">
function CheckForm()
{
    if (document.regform.oldpassword.value != document.regform.password3.value) {
		alert("原密码输入错误！");
		document.regform.oldpassword.focus();
		return false;
    }

    if (document.regform.password.value.length == 0) {
		alert("请输入你的新密码.");
		document.regform.password.focus();
		return false;
	}

    if (document.regform.password.value != document.regform.password2.value) {
		alert("两次输入密码不相同.");
		document.regform.password.focus();
		return false;
	}
		
    if (document.regform.qq.value.length == 0) {
		alert("请输入QQ号码.");
		document.regform.qq.focus();
		return false;
	}
}
</script>
<script language="javascript">
	function SwitchCover(nCover,nBookID,sImageType,sexx)
	{
	var sex=sexx
	if (sex=="girl")
	     sex="g"
		else
	  sex="b"
	 	if(nCover==-1)
			preview.src="../diary/face/"+nBookID+"."+sImageType
		else
			preview.src="../diary/face/"+sex+nCover+""
	}
	function UploadCover(sPath)
	{
		preview.src=sPath
	}
	function SetCurrentCover(nCover)
	{
		bookcover=document.all("bookcover")
		for(var i=0;i<bookcover.options.length;i++)
		{
			if(bookcover(i).value==nCover)
			{
				bookcover(i).selected=true;
				return;
			}
		}
	}
	
</script>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" style="background-color=transparent">
<table width="284" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td height="370" width="284" align="right">
      <table border="0" width="284" id="table8" cellspacing="0" cellpadding="0" height="370">
        <tr> 
          <td height="19" colspan="3">　</td>
        </tr>
        <tr> 
          <td height="19" width="74"></td>
          <td height="19" colspan="2"><font color="#51300C"><font color="#800000"><%=rs("username")%></font> 
            人物属性设置</font></td>
        </tr>
        <tr> 
          <td background="diary/linebg2.gif" colspan="3" height="1"><img border="0" src="diary/linebg2.gif" width="4" height="1"></td>
        </tr>
        <tr valign="top"> 
          <td colspan="2"><img id="preview" src="<%=alltubg%><%=image%>" width="75" height="150"> 
          </td>
          <td width="209"> 
            <form language="javascript"  name="regform" method="post" action=mroleset.asp?userid=<%=userid%>&action=edit onSubmit="return CheckForm()">
              <table border="0" width="99%" id="table7" cellspacing="0" cellpadding="0" height="100%" align="center">
                <tr> 
                  <td width="66"></td>
                  <td width="138"></td>
                </tr>
                <tr> 
                  <td width="66" height="19"><b><font color="#77520A">注册账户:</font></b></td>
                  <td width="138" height="19"> <%=username%></td>
                </tr>
                <tr> 
                  <td width="66" height="19"><b><font color="#77520A">用户性别:</font></b></td>
                  <td width="138" height="19"> 
                    <select name="sex" class="input" id="sex" style="width:60px">
                      <option value="girl" <%if sex="girl" then response.Write("selected")%>>女孩</option>
                      <option value="boy" <%if sex="boy" then response.Write("selected")%>>男孩</option>
                    </select>
                  </td>
                </tr>
                <tr> 
                  <td width="66" height="19"><font color="#77520A"><b>原 密 码:</b></font></td>
                  <td width="138" height="19"> 
                    <input name="oldpassword" type="password" id="oldpassword" value=<%=password3%> size="18" maxlength="12">
                  </td>
                </tr>
                <tr> 
                  <td width="66" height="19"><font color="#77520A"><b>新 密 码:</b></font></td>
                  <td width="138" height="19"> 
                    <input name="password" type="password" id="password" size="18" maxlength="12" value="<%=password3%>">
                  </td>
                </tr>
                <tr> 
                  <td width="66" height="19"><font color="#77520A"><b>重输密码:</b></font></td>
                  <td width="138" height="19"> 
                    <input name="password2" type="password" id="password2" size="18" maxlength="12" value="<%=password3%>">
                  </td>
                </tr>
                <tr> 
                  <td width="66" height="23"><b><font color="#77520A">个人形象:</font></b></td>
                  <td width="138" height="23"> 
                    <%image=image1%>
                    <select name="image" class="input" id="image" style="width:100px" onChange="SwitchCover(this.value,6913,'gif',document.regform.sex.options[document.regform.sex.selectedIndex].value)">
                      <option value="01.gif" <%if image="01.gif" then response.Write("selected")%>>图 
                      片 1</option>
                      <option value="02.gif" <%if image="02.gif" then response.Write("selected")%>>图 
                      片 2</option>
                      <option value="03.gif" <%if image="03.gif" then response.Write("selected")%>>图 
                      片 3</option>
                      <option value="04.gif" <%if image="04.gif" then response.Write("selected")%>>图 
                      片 4</option>
                      <option value="05.gif" <%if image="05.gif" then response.Write("selected")%>>图 
                      片 5</option>
                      <option value="06.gif" <%if image="06.gif" then response.Write("selected")%>>图 
                      片 6</option>
                      <option value="07.gif" <%if image="07.gif" then response.Write("selected")%>>图 
                      片 7</option>
                      <option value="08.gif" <%if image="08.gif" then response.Write("selected")%>>图 
                      片 8</option>
                      <option value="09.gif" <%if image="09.gif" then response.Write("selected")%>>图 
                      片 9</option>
                      <option value="10.gif" <%if image="10.gif" then response.Write("selected")%>>图 
                      片 10</option>
                    </select>
                  </td>
                </tr>
                <tr> 
                  <td width="66" height="19"><font color="#77520A"><b>扣扣号码:</b></font> 
                  </td>
                  <td width="138" height="19"> 
                    <input name="qq" type="text" id="qq" size="18" maxlength="12" value="<%=qq%>">
                  </td>
                </tr>
                <tr> 
                  <td colspan="2" height="19"><font color="#77520A"><b>个性说明:(请勿超过52个字)</b></font></td>
                </tr>
                <tr> 
                  <td colspan="2" height="19"><font color="#77520A"></font> 
                    <textarea name="url" id="username3" cols="25" rows="6"><%=url%></textarea>
                  </td>
                </tr>
                <tr> 
                  <td colspan="2"> 
                    <p align="center"><font color="#FF0000">*请注意密码为6到12位</font> 
                  </td>
                </tr>
                <tr> 
                  <input name="password3" type="hidden" id="password3" value="<%=password3%>">
                  <td colspan="2"> 
                    <p align="center"> 
                      <input type="submit" name="Submit" value=" 提 交 ">
                      <input type="reset" name="Submit2" value=" 重 置 ">
                  </td>
                </tr>
                <tr> 
                  <td colspan="2" height="100%">&nbsp;</td>
                </tr>
              </table>
            </form>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>
</html>


