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



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




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

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