📄 userinfo.asp
字号:
<%if session("username")="" or session("userkey")="" then
response.redirect "../../"
end if%>
<!--#include file="mozeenconn.asp"-->
<link href=../css/main.css rel=stylesheet>
<!--#include file="./inc/char.asp"-->
<!--#include file="md5.asp"-->
<%call main()%>
<%sub main()%>
<table width="95%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#999999">
<tr>
<td height="20" bgcolor="#eeeeee">当前位置:<a href=main.asp>管理首页</a> >> <a href=userinfo.asp?username=<%=session("username")%>>个人信息</a></td>
</tr>
</table>
<%
if request("action") = "useredit" then
call useredit()
elseif request("action") = "saveuseredit" then
call saveuseredit()
elseif request("action") = "pwdedit" then
call pwdedit()
elseif request("action") = "savepwdedit" then
call savepwdedit()
else
call userinfo()
end if
end sub
%>
<%sub userinfo()%>
<%
username=request("username")
set rs=server.createobject("adodb.recordset")
sql="select * from [Users] where username='"&UserName&"'"
rs.open sql,conn,1,1
if RS.EOF then
Response.Write("<center><br><font color=red>该用户不存在</font>")
else
%>
<table width="95%" cellspacing="1" cellpadding="3" bgcolor="#999999" align="center">
<tr bgcolor="#CCCCCC">
<td colspan="5" align="center"><b><%=request("username")%> 的个人信息</b></td>
</tr>
<tr bgcolor="#eeeeee">
<td colspan="2" align="center"><font color="#0033CC">【 基 本 信 息 】</font></td>
<td rowspan="11" width="10%"></td>
<td colspan="2" align="center"><font color="#0033CC">【 联 系 方 式 】</font></td>
</tr>
<tr bgcolor="#eeeeee">
<td align="right">用户名:</td>
<td ><%=rs("username")%></td>
<td align="right">电子邮件:</td>
<td ><a href=mailto:<%=rs("U_email")%>><%=rs("U_email")%></a></td>
</tr>
<tr bgcolor="#eeeeee">
<td align="right">真实姓名:</td>
<td ><%=rs("U_name")%></td>
<td align="right">电话:</td>
<td ><%=rs("U_tel")%></td>
</tr>
<tr bgcolor="#eeeeee">
<td align="right">性别:</td>
<td ><%if rs("U_sex")=1 then%> 男 <% else %> 女<% end if %></td>
<td align="right">OICQ:</td>
<td ><%=rs("U_oicq")%></td>
</tr>
<tr bgcolor="#eeeeee">
<td align="right">出生年月:</td>
<td ><%=rs("U_birthday")%></td>
<td align="right">通讯地址:</td>
<td ><%=rs("U_address")%></td>
</tr>
<tr bgcolor="#eeeeee">
<td align="right">发表文章:</td>
<td ><%=rs("ArticleNum")%></td>
<td align="right">邮编:</td>
<td ><%=rs("U_zip")%></td>
</tr>
<tr bgcolor="#eeeeee">
<td align="right">登陆次数:</td>
<td ><%=rs("LoginNum")%></td>
<td align="center" colspan="2"><font color="#0033CC">【 个 人 说 明 】</font></td>
</tr>
<tr bgcolor="#eeeeee">
<td align="right">登陆IP:</td>
<td ><%=rs("LoginIP")%></td>
<td colspan="2" rowspan="3"><%=rs("U_info")%></td>
</tr>
<tr bgcolor="#eeeeee">
<td align="right">注册日期:</td>
<td ><%=rs("Addtime")%></td>
</tr>
<tr bgcolor="#eeeeee">
<td align="right">最后登陆:</td>
<td ><%=rs("Lastlogintime")%></td>
</tr>
<tr bgcolor="#eeeeee">
<td align="right">管理等级:</td>
<td ><% if rs("userkey")=1 then %> 录入员<% elseif rs("userkey")=2 then %>斑竹<% elseif rs("userkey")=3 then %>管理员<% elseif rs("userkey")=4 then %>系统管理员<% end if %></td>
<td align="right" colspan="2"><% if session("username")=request("username") or session("userkey")=4 then %>【<a href=userinfo.asp?username=<%=request("username")%>&action=pwdedit><font color=cc0000>更改密码</font></a>】【<a href=userinfo.asp?username=<%=request("username")%>&action=useredit><font color=cc0000>修改信息</font></a>】<% end if %></td>
</tr>
</table>
<%end if
rs.close
set rs=nothing
end sub%>
<!---修改个人信息--->
<%sub useredit()%>
<%if session("username")=request("username") or session("userkey")=4 then %>
<%
username=request("username")
set rs=server.createobject("adodb.recordset")
sql="select * from [Users] where username='"&UserName&"'"
rs.open sql,conn,1,1
%>
<table width="95%" cellspacing="1" cellpadding="3" bgcolor="#999999" align="center">
<form action="userinfo.asp?action=saveuseredit&userid=<%=rs("userid")%>" method=POST name=useredit >
<tr bgcolor="#CCCCCC"><td colspan="2" align="center"><b>修改 <%=request("username")%> 的个人信息</b></td></tr>
<tr bgcolor=#eeeeee><td align=right width=35%>用户名:</td><td><input type=text name=username size=20 value=<%=rs("username")%> readonly></td></tr>
<tr bgcolor=#eeeeee><td align=right>真实姓名:</td><td><input type=text name=U_name size=20 value=<%=rs("U_name")%> ></td></tr>
<tr bgcolor=#eeeeee><td align=right>性别:</td><td><%if rs("U_sex")=1 then%><input type="radio" name="U_sex" value=1 checked>男<input type="radio" name="U_sex" value=0>女<%else%><input type="radio" name="U_sex" value=1 >男<input type="radio" name="U_sex" value=0 checked>女<%end if%></td></tr>
<tr bgcolor=#eeeeee><td align=right>出生年月:</td><td>
<select name=birthyear><option value=""></option><%for i=1901 to 2000%><option value="<%=i%>" <%if not isnull(rs("U_birthday")) or rs("U_birthday")<>"" then%><%if cint(year(rs("U_birthday")))=cint(i) then response.write "selected"%><%end if%>><%=i%></option><%next%></select>年
<select name=birthmonth><option value=""></option><%for i=1 to 12%><option value="<%=i%>" <%if not isnull(rs("U_birthday")) or rs("U_birthday")<>"" then%><%if cint(month(rs("U_birthday")))=cint(i) then response.write "selected"%><%end if%>><%=i%></option><%next%></select>月
<select name=birthday><option value=""></option><%for i=1 to 31%><option value="<%=i%>" <%if not isnull(rs("U_birthday")) or rs("U_birthday")<>"" then%><%if cint(day(rs("U_birthday")))=cint(i) then response.write "selected"%><%end if%>><%=i%></option><%next%></select>日
</td></tr>
<tr bgcolor=#eeeeee><td align=right>电子邮件:</td><td><input type=text name=U_email size=30 value=<%=rs("U_email")%> ></td></tr>
<tr bgcolor=#eeeeee><td align=right>联系电话:</td><td><input type=text name=U_tel size=30 value=<%=rs("U_tel")%> ></td></tr>
<tr bgcolor=#eeeeee><td align=right>QQ:</td><td><input type=text name=U_oicq size=30 value=<%=rs("U_oicq")%> ></td></tr>
<tr bgcolor=#eeeeee><td align=right>通讯地址:</td><td><textarea name="U_address" cols="40" rows="2"><%=rs("U_address")%></textarea></td></tr>
<tr bgcolor=#eeeeee><td align=right>邮编:</td><td><input type=text name=U_zip size=15 value=<%=rs("U_zip")%> ></td></tr>
<tr bgcolor=#eeeeee><td align=right>个人简介:</td><td><textarea name="U_info" cols="40" rows="5"><%=rs("U_info")%></textarea></td></tr>
<tr bgcolor=#eeeeee><td></td><td><input type="submit" name="Submit" value="确定"> <input type="Reset" name="Reset" value="重填"></td></tr>
</form></table>
<%rs.close
set rs=nothing
else%>
<script language=javascript>
alert( "错误:您无权编辑此用户信息!" );
location.href = "javascript:history.back()"
</script>
<%end if%>
<%end sub%>
<!---保存个人修改信息--->
<%sub saveuseredit()%>
<%if request("U_name")="" then%>
<script language=javascript>
alert( "错误:请输入真实姓名!" );
location.href = "javascript:history.back()"
</script>
<%elseif request("U_email")="" then%>
<script language=javascript>
alert( "错误:请输入电子邮件!" );
location.href = "javascript:history.back()"
</script>
<%elseif request("U_tel")="" then%>
<script language=javascript>
alert( "错误:请输入联系电话!" );
location.href = "javascript:history.back()"
</script>
<%else%>
<%
if request.Form("birthyear")="" or request.form("birthmonth")="" or request.form("birthday")="" then
birthday=""
else
birthday=trim(Request.Form("birthyear"))&"-"&trim(Request.Form("birthmonth"))&"-"&trim(Request.Form("birthday"))
end if
sql="update users set username='"&HTMLEncode(request("username"))&"',U_name='"&HTMLEncode(request("U_name"))&"',U_sex='"&request("U_sex")&"',U_email='"&HTMLEncode(request("U_email"))&"',U_tel='"&HTMLEncode(request("U_tel"))&"',U_oicq='"&HTMLEncode(request("U_oicq"))&"',U_address='"&HTMLEncode(request("U_address"))&"',U_zip='"&HTMLEncode(request("U_zip"))&"',U_info='"&HTMLEncode(request("U_info"))&"',U_birthday='"& birthday &"' where userid="&cstr(request("userid"))
conn.execute(sql)
%>
<script language=javascript>
alert( "个人信息修改成功" );
location.href = "javascript:history.back()"
</script>
<%end if%>
<%end sub%>
<!---更改密码--->
<%sub pwdedit()%>
<%if session("username")=request("username") or session("userkey")=4 then %>
<%
username=request("username")
set rs=server.createobject("adodb.recordset")
sql="select * from [Users] where username='"&UserName&"'"
rs.open sql,conn,1,1
%>
<table width="95%" cellspacing="1" cellpadding="3" bgcolor="#999999" align="center">
<form action="userinfo.asp?action=savepwdedit&userid=<%=rs("userid")%>" method=POST name=useredit >
<tr bgcolor="#CCCCCC"><td colspan="2" align="center"><b>修改 <%=request("username")%> 的密码</b></td></tr>
<tr bgcolor=#eeeeee><td align=right width=35%>用户名:</td><td><input type=text name=username size=20 value=<%=rs("username")%> readonly></td></tr>
<tr bgcolor=#eeeeee><td align=right>旧密码:</td><td><input type=text name=olduserpwd size=20 value="请牢记您的密码" readonly ></td></tr>
<tr bgcolor=#eeeeee><td align=right>新密码:</td><td><input type=password name=newuserpwd size=20></td></tr>
<tr bgcolor=#eeeeee><td align=right>密码确认:</td><td><input type=password name=confirmpwd size=20></td></tr>
<tr bgcolor=#eeeeee><td></td><td><input type="submit" name="Submit" value="确定"> <input type="Reset" name="Reset" value="重填"></td></tr>
</form></table>
<%rs.close
set rs=nothing
else%>
<script language=javascript>
alert( "错误:您无权更改此用户密码!" );
location.href = "javascript:history.back()"
</script>
<%end if%>
<%end sub%>
<!---保存密码--->
<%sub savepwdedit()%>
<%if request("newuserpwd")="" then%>
<script language=javascript>
alert( "错误:请输入新密码!" );
location.href = "javascript:history.back()"
</script>
<%elseif request("confirmpwd")="" then%>
<script language=javascript>
alert( "错误:请输入确认密码!" );
location.href = "javascript:history.back()"
</script>
<%elseif request("newuserpwd")<>request("confirmpwd") then%>
<script language=javascript>
alert( "错误:两次输入的密码不一致!" );
location.href = "javascript:history.back()"
</script>
<%elseif request("newuserpwd")=request("olduserpwd") then%>
<script language=javascript>
alert( "错误:怎么和旧密码一样!" );
location.href = "javascript:history.back()"
</script>
<%else%>
<%
sql="update users set userpwd='"&md5(trim(request("newuserpwd")))&"' where userid="&cstr(request("userid"))
conn.execute(sql)
%>
<script language=javascript>
alert( "恭喜,密码更改成功!//刷新后可看到您的新密码" );
location.href = "javascript:history.back()"
</script>
<%end if%>
<%end sub%>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
</tr>
</table>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -