标题:请问这该怎么写.我试了N次
只看楼主
rtc
Rank: 2
等 级:新手上路
威 望:4
帖 子:590
专家分:0
注 册:2007-6-6
 问题点数:0 回复次数:4 
请问这该怎么写.我试了N次

<%
if session("pass")<>"rt" then

response.Write("<script language='javascript'>alert('先请登录为管理员');this.top.location.href='admin_login.asp';</script>")
response.end()
end if
%>
<!--#include file="inc\conn1.asp"-->

<%


if request.Form("o")="tianjia" then
if trim(Request.Form("username"))="" then
Response.Write("<script language=javascript>alert(' 用户名不能为空!')</script>")
Response.End()
end if
if trim(Request.Form("password"))="" then
Response.Write("<script language=javascript>alert('密码不能为空!')</script>")
Response.End()
end if
if trim(Request.Form("password"))<>trim(Request.Form("password1")) then
Response.Write("<script language=javascript>alert('两次密码必须相同,请重新输入!')</script>")
Response.End()
end if


set rs=server.CreateObject("adodb.recordset")
sql="select*from user "
rs.open sql,cn,1,3
rs.addnew
rs("user")=trim(Request.Form("username"))
rs("password")=trim(Request.Form("password"))
rs.update
rs.close
set rs=nothing
cn.close
set cn=nothing
response.Write("<script language='javascript'>alert('添加成功,请记住你的用户名与密码');this.top.location.href='admin.asp';</script>")
response.end()






end if
%>
我想判断数据库有没相同的用户.
我是用
set rs=server.CreateObject("adodb.recordset")
sql="select*from user where user="&request("user")
rs.open sql,cn,1,3
if rs.recordcount <>0 then
response.write "有相同用户"
else
rs.addnew
rs("user")=trim(Request.Form("username"))
rs("password")=trim(Request.Form("password"))
rs.update
rs.close
set rs=nothing
cn.close
set cn=nothing
response.Write("<script language='javascript'>alert('添加成功,请记住你的用户名与密码');this.top.location.href='admin.asp';</script>")
response.end()

应该怎么写

[此贴子已经被作者于2007-7-5 20:50:10编辑过]

搜索更多相关主题的帖子: javascript include 用户名 管理员 file 
2007-07-05 20:49
shdyh977
Rank: 1
等 级:新手上路
威 望:1
帖 子:109
专家分:0
注 册:2007-5-22
得分:0 
set rs=server.CreateObject("adodb.recordset")
sql="select * from user where user='"&request("user")&"'"
rs.open sql,cn,1,3
if not rs.eof then
response.write "有相同用户"
else
rs.addnew
rs("user")=trim(Request.Form("username"))
rs("password")=trim(Request.Form("password"))
rs.update
rs.close
set rs=nothing
response.Write("<script language='javascript'>alert('添加成功,请记住你的用户名与密码');this.top.location.href='admin.asp';</script>")
response.end()
end if
2007-07-06 09:24
huang88
Rank: 1
等 级:新手上路
帖 子:86
专家分:0
注 册:2007-5-22
得分:0 
user_request=request("user")
set rs=server.CreateObject("adodb.recordset")
sql="select * from user where user='"&user_request&"'"
rs.open sql,cn,1,3
if not rs.eof then
response.write "有相同用户"
else
rs.addnew
rs("user")=trim(Request.Form("username"))
rs("password")=trim(Request.Form("password"))
rs.update
rs.close
set rs=nothing
response.Write("<script language='javascript'>alert('添加成功,请记住你的用户名与密码');this.top.location.href='admin.asp';</script>")
response.end()
end if
2007-07-06 09:27
rtc
Rank: 2
等 级:新手上路
威 望:4
帖 子:590
专家分:0
注 册:2007-6-6
得分:0 

if request.Form("o")="tianjia" then
if trim(Request.Form("username"))="" then
Response.Write("<script language=javascript>alert(' 用户名不能为空!')</script>")
Response.End()
end if
if trim(Request.Form("password"))="" then
Response.Write("<script language=javascript>alert('密码不能为空!')</script>")
Response.End()
end if
if trim(Request.Form("password"))<>trim(Request.Form("password1")) then
Response.Write("<script language=javascript>alert('两次密码必须相同,请重新输入!')</script>")
Response.End()
end if

dim user
user_request=request("user")
set rs=server.CreateObject("adodb.recordset")
sql="select * from user where user='"&user_request&"'"
rs.open sql,cn,1,3

if not rs.eof then
response.write "有相同用户"

else
rs.addnew
rs("user")=trim(Request.Form("username"))
rs("password")=trim(Request.Form("password"))
rs.update
rs.close
set rs=nothing
cn.close
set cn=nothing
response.Write("<script language='javascript'>alert('添加成功,请记住你的用户名与密码');this.top.location.href='admin.asp';</script>")
response.end()

end if





end if
没用
完全当透明
还是添加的了

2007-07-06 10:01
yndkai
Rank: 3Rank: 3
等 级:新手上路
威 望:7
帖 子:275
专家分:0
注 册:2007-6-1
得分:0 
set rs=server.CreateObject("adodb.recordset")
sql="select*from user where user="&request("user")
rs.open sql,cn,1,3
if rs.eof and rs.bof then
rs.addnew
rs("user")=trim(Request.Form("username"))
rs("password")=trim(Request.Form("password"))
rs.update
rs.close
set rs=nothing
cn.close
set cn=nothing
response.Write("<script language='javascript'>alert('添加成功,请记住你的用户名与密码');this.top.location.href='admin.asp';</script>")
else
response.write "有相同用户"
response.end()

试试

本来讨厌下雨的天空 直到听见有人说爱我
2007-07-06 11:00



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




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

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