📄 userinf.asp
字号:
<%response.expires=0%>
<!--#include file="sqlstr.asp"-->
<!--#include file="opendb.asp"-->
<!--#include file="../Electron_Doc/public/public.asp"-->
<%
function strlength(inputstr)
dim length,i
length=0
for i=1 to len(inputstr)
if asc(mid(inputstr,i,1))<0 then
length=length+2
else
length=length+1
end if
next
strlength=length
end function
sub userinf(href)
oabusyusername=request.cookies("oabusyusername")
oabusyuserdept=request.cookies("oabusyuserdept")
oabusyuserlevel=request.cookies("oabusyuserlevel")
if request("submit")="更改" then
errorinfo=""
password=request("password")
if strlength(password)>20 then
errorinfo=errorinfo&"密码太长,不能超过20个字符!<br>"
end if
name=request("name")
if strlength(name)>10 then
errorinfo=errorinfo&"姓名太长,不能超过5个汉字或10个英文字符!<br>"
end if
if errorinfo="" then
on error resume next
set conn=opendb("oabusy","conn","accessdsn")
conn.begintrans
sql = "update userinf set "
sql = sql & "password=" & SqlStr(password) & ", "
sql = sql & "name=" & SqlStr(name) & " where username=" & sqlstr(oabusyusername)
sqlstr(oabusyusername)
conn.Execute(sql)
if err.number<>0 then
conn.rollbacktrans
call DispErrorInfo1("修改用户信息出错!出错原因:"&err.description)
conn.close
set conn=nothing
response.end
else
conn.committrans
%>
<br><br>
<font color="red" size="+1">用户资料修改成功!</font>
<br><br>
<%
end if
else
%>
<div align="center">
<table width="80%" border="0">
<tr><td>
<center><b><font color="red" size="+1">出错了</font></b></center><br><br>
<font color="#ee0000" size="+1"><%=errorinfo%></font>
<center><input type="button" value="返回" onclick="history.go( -1 );return true;"></center>
</td></tr></table>
</div>
<%
end if
else
%>
<script Language="JavaScript">
function maxlength(str,minl,maxl)
{
if(str.length <= maxl && str.length >= minl)
{
return true;
}
else
{
return false;
}
}
function form_check()
{
var l2=maxlength(document.form2.password.value,1,20);
if(!l2)
{
window.alert("密码的长度大于1位小于20位");
document.form2.password.focus();
return (false);
}
var a1=document.form2.password.value;
var a2=document.form2.repassword.value;
if(a1!=a2)
{
window.alert("两次输入的密码应相同");
document.form2.repassword.focus();
return (false);
}
var l3=maxlength(document.form2.name.value,1,10);
if(!l3)
{
window.alert("姓名的长度不能超过5个汉字或10个字符!");
document.form2.name.focus();
return (false);
}
}
</script>
<%
set conn=opendb("oabusy","conn","accessdsn")
set rs=server.createobject("adodb.recordset")
on error resume next
rs.open "select count(*) as countss from userinf",conn,1,1
usercount=rs("countss")
if usercount >500 then
rs.close
set rs=nothing
%>
<script language=javascript>
window.alert("对不起,超过了最大使用用户数,请删除部分用户!");
location.href="/usercontrol.asp";
</script>
<%
end if
rs.close
sql="select * from userinf where username=" & sqlstr(oabusyusername)
rs.open sql,conn,1
%>
<br><br>
<form action="<%=href%>" method=post name="form2" onsubmit="return form_check();">
<table border="1" cellspacing="0" cellpadding="0" bordercolorlight="#c0c0c0" bordercolordark="#FFFFFF">
<tr height="25">
<td>
用 户 名:<%=oabusyusername%>
</td>
</tr>
<tr height="25">
<td>
密 码:<input type="password" name="password" size=20 value="<%=rs("password")%>" maxlength="20">
</td>
</tr>
<tr height="25">
<td>
密码确认:<input type="password" name="repassword" size=20 value="<%=rs("password")%>" maxlength="20">
</td>
</tr height="25">
<tr>
<td>
姓 名:<input type="text" name="name" size=20 value="<%=rs("name")%>" maxlength="10">
</td>
</tr>
<tr height="25">
<td>
部 门:<%=oabusyuserdept%>
</td>
</tr>
<tr height="25">
<td>
职 位:<%=oabusyuserlevel%>
</td>
</tr>
<tr height="25">
<td align=center>
<input type="submit" name="submit" value="更改">
</td>
</tr>
</table>
</form>
<%
end if
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -