标题:问题出在那里谁可以告诉我
只看楼主
rtc
Rank: 2
等 级:新手上路
威 望:4
帖 子:590
专家分:0
注 册:2007-6-6
 问题点数:0 回复次数:2 
问题出在那里谁可以告诉我

<!--#include file="conn.asp"-->

<%
if session("pass")<>"1" then
response.Write("<script language='javascript'>alert('先请登录为管理员');this.top.location.href='log.asp';</script>")
response.end()
end if
%>

<%

set rs=server.CreateObject("adodb.recordset")
sql="select*from user where id="&session("userid")
rs.open sql,cn,1,3
if request.Form("o")="xg" then
if request.Form("password")="" or request.Form("password1")="" then
response.Write("<script language='javascript'>alert('必须输入密码');this.top.location.href='admin.asp';</script>")
response.end()
end if
if request.Form("password")<>request.Form("password1") then
response.Write("<script language='javascript'>alert('2次密码必须相同');this.top.location.href='admin.asp';</script>")
response.end()
end if
rs.addnew
rs("password")=request.Form("password1")
rs.update
response.Write("<script language='javascript'>alert('修改密码成功,请记住你的密码!');this.top.location.href='admin.asp';</script>")
response.end()

end if
%>

这是我的修改密码 不知道为什么每次本来的密码没修改修改
却添加一新密码!!!!

搜索更多相关主题的帖子: javascript password 管理员 where 
2007-06-14 19:00
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:0 

<!--#include file="conn.asp"-->

<%
if session("pass")<>"1" then
response.Write "<script language='javascript'>"
response.Write "alert('先请登录为管理员');"
response.Write "this.top.location.href='log.asp';"
response.Write "</script>"
response.end()
end if
set rs=server.CreateObject("adodb.recordset")
sql="select*from user where id="&session("userid")
rs.open sql,cn,1,3
if request.Form("o")="xg" then
if request.Form("password")="" or request.Form("password1")="" then
response.Write "<script language='javascript'>"
response.Write "alert('必须输入密码');"
response.Write "this.top.location.href='admin.asp';"
response.Write "</script>"
response.end()
end if
if request.Form("password")<>request.Form("password1") then
response.Write "<script language='javascript'>"
response.Write "alert('2次密码必须相同');"
response.Write "this.top.location.href='admin.asp';"
response.Write "</script>"
response.end()
end if
rs.addnew
rs("password")=request.Form("password1")
rs.update
response.Write "<script language='javascript'>"
response.Write "alert('修改密码成功,请记住你的密码!');"
response.Write "this.top.location.href='admin.asp';"
response.Write "</script>"
response.end()
end if
%>
修改就不要加addnew了。

2007-06-14 20:50
恒天
Rank: 1
等 级:新手上路
威 望:2
帖 子:165
专家分:0
注 册:2007-6-1
得分:0 
把2楼红色那部分去掉就是了
2007-06-15 17:23



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-147520-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.177904 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved