28,390
社区成员
发帖
与我相关
我的任务
分享
<form action="x.asp" method="post">
用户名:<input type="text" name="un" /><br />
密 码:<input type="password" name="pwd" /><input type="submit" value="登陆" />
</form>
x.asp
<%
un=request.Form("un"):pwd=request.Form("pwd")
if un<>"" and pwd<>"" then
un=replace(un,"'","''"):pwd=replace(pwd,"'","''")
set conn=server.CreateObject("adodb.connection")
conn.open "你的驱动字符串"
set rs=conn.execute("select * from usertable where username='"&un&"' and password='"&pwd&"'"
if rs.eof or rs.bof then
response.Write "<script>alert('用户名密码错误!');history.back()</script>"
else
session("user")=un
response.Write "<script>alert('登陆成功!');location='登陆成功后调整的url地址'</script>"
end if
rs.close:set rs=nothing:conn.close:set conn=nothing
else
response.Write "<script>alert('用户名密码不能为空!');history.back()</script>"
end if
%>