用户修改问题
<%if session("admin_name")="" then
response.write "<SCRIPT language=JavaScript>alert('对不起,你没有权限打开此页!');"
response.write"this.location.href='../index.asp';</SCRIPT>"
response.end
end if
%>
<!--#include file="addconn.asp" -->
<%
add=request("add")
id=request("MemberId")
pass=request.form("Password")
nm=request.form("Name")
dizhi=request.form("Address")
qq=request.form("qq")
phone=request.form("phone")
nn=request.form("nn")
jj=request.form("jj")
if dizhi="" then
dizhi="这家伙很懒没有填写!"
else
end if
if qq="" then
qq="无"
else
end if
if phone="" then
phone="无"
else
end if
if nn="" then
nn="这家伙很懒没有填写!"
else
end if
if jj="" then
jj="这家伙很懒没有填写!"
else
end if
set rs=server.createobject("adodb.recordset")
if add="edit" and id<>"" then //可能是这里出问题
sql="select * from member where MemberId="&id
rs.open sql,conn,1,3
rs("Password")=pass
rs("Name")=nm
rs("Address")=dizhi
rs("qq")=qq
rs("phone")=phone
rs("nn")=nn
rs("jj")=jj
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
else
response.write "<SCRIPT language=JavaScript>alert('对不起,请联系系统管理员!');"
response.write"this.location.href='admin_hy.asp';</SCRIPT>"
response.end
end if
%>
<link rel="stylesheet" type="text/css" href="../style.css">
<BODY topMargin=0 leftmargin="0" marginheight="0">
<div align="center"><br>
<TABLE width="600" border="0" cellspacing="0" cellpadding="0">
<TR height=25>
<TD align="left" class="f11"><font color="#FF0000">会员信息管理</font></TD>
</TR>
</TABLE>
<TABLE border=1 cellPadding=4 cellSpacing=0 width="600" bordercolorlight="#326598" bordercolordark="#ffffff">
<TR class="unnamed1" height=28 >
<TD height="25" align="center" background="../images/admin_bg_1.gif">信息修改成功</td>
</TR>
<TR height="28" bgcolor="#ffffff">
<TD align="center" bgcolor="#ffffff">〖<a href="admin_hy.asp">点击返回</a>〗</td>
</TR>
</TABLE>
</div>
红色部分什么意思?大概意思我应该知道!但不知道为什么,每次点击修改按妞多提示“对不起,请联系系统管理员!”我已经是管理员身份登陆的啦!
修改资料代码如下:
<%@ codepage ="936" %>
<%
if session("admin_name")="" then
response.write "<SCRIPT language=JavaScript>alert('对不起,你没有权限打开此页!');"
response.write"this.location.href='../index.asp';</SCRIPT>"
response.end
end if
%>
<!--#include file="addconn.asp" -->
<%
dim id
id=request.QueryString("id")
set rs=server.createobject("adodb.recordset")
sql="select * from member where MemberId="&id
rs.open sql,conn,1,1
if rs.eof then
response.write "<SCRIPT language=JavaScript>alert('对不起,请联系系统管理员!');"
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write"this.location.href='admin_hy.asp';</SCRIPT>"
response.end
else
end if
%>
<link rel="stylesheet" type="text/css" href="../style.css">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<BODY topMargin=0 leftmargin="0" marginheight="0">
<br>
<br>
<div align="center">
<TABLE width="500" border="0" cellspacing="0" cellpadding="0">
<TR height=25>
<TD align="left" class="f11"><font color="#FF0000">修改会员注册信息</font></TD>
</TR>
</TABLE>
</div>
<script language="JavaScript">
function checkdata() {
if( form1.user.value.length<4 ) {
alert("\请重新输入用户名,长度为4-10位任何字符 !!")
return false;
}
if( form1.pass.value.length<4 ) {
alert("\请重新输入密码,密码长度为6-12位任何字符 !!")
return false;
}
if( form1.pass1.value =="" ) {
alert("\请输入密码确认 !!")
return false;
}
if( form1.pass1.value != form1.pass.value ) {
alert("\两次密码输入不一致 !!")
return false;
}
if( form1.xb.value == "") {
alert("\请选择性别!!")
return false;
}
return (true);
}
</script>
<form name="form1" method="post" action="mosave.asp?id=<%=rs("MemberId")%>" onSubmit="return checkdata()">
<div align="center">
<TABLE border=1 cellPadding=4 cellSpacing=0 width="500" bordercolorlight="##FF0000" bordercolordark="#ffffff">
<TR align="center">
<TD height="25" colspan="3" background="../images/admin_bg_1.gif" class="unnamed1">修改会员:<%=rs("user")%>
的注册信息 </TD>
</TR>
<TR>
<TD width="32%" height="0" align="right">用户名:</TD>
<TD height="0" colspan="2"><font color="ff0000"><%=rs("Name")%></font></TD>
</TR>
<TR>
<TD height="0" align="right">昵称:</TD>
<TD height="0" colspan="2"><input name="nm" type="text" id="nm" value="<%=rs("Name")%>" size="35" maxlength="30"></TD>
</TR>
<TR>
<TD height="0" align="right">密码:</TD>
<TD height="0" colspan="2"> <input name="pass" type="text" id="title4" value="<%=rs("Password")%>" size="35" maxlength="30"></TD>
</TR>
<TR>
<TD height="0" align="right">地址:</TD>
<TD height="0" colspan="2"> <input name="dizhi" type="text" id="title6" value="<%=rs("address")%>" size="35" maxlength="30"></TD>
</TR>
<TR>
<TD height="0" align="right">QQ号:</TD>
<TD height="0" colspan="2"> <input name="qq" type="text" id="title7" value="<%=rs("qq")%>" size="35" maxlength="30"></TD>
</TR>
<TR>
<TD height="9" align="right">电话:</TD>
<TD height="0" colspan="2"> <input name="phone" type="text" id="title8" value="<%=rs("phone")%>" size="35" maxlength="30"></TD>
</TR>
<TR>
<TD height="17" align="right">性别:</TD>
<TD height="0" colspan="2"><%=rs("xb")%></TD>
</TR>
<TR>
<TD height="17" align="right">年龄:</TD>
<TD height="0" colspan="2"> <input name="nn" type="text" id="title10" value="<%=rs("nn")%>" size="35" maxlength="30"></TD>
</TR>
<TR>
<TD height="17" align="right">简介:</TD>
<TD height="17" colspan="2"> <textarea name="jj" cols="35" rows="5" id="title11"><%=rs("jj")%></textarea></TD>
</TR>
<TR>
<TD colspan="3" height="18"><div align="center">
<input name="add" type="hidden" id="add" value="edit"> //这有什么用呢?
<input type="submit" name="Submit" value="修改">
<input type="reset" name="Submit2" value="重设">
</div></TD>
</TR>
<TR >
<TD height="25" colspan="3" background="../images/admin_bg_1.gif" align="center"class="unnamed1">〖<a href="admin_hy.asp"><font color="#FFFFFF">点击返回</font></a>〗
</TD>
</TR>
</TABLE>
</div>
</form>