教学文库网 - 权威文档分享云平台
您的当前位置:首页 > 文库大全 > 高等教育 >

段简单的ASP连接数据库登入验证代码 .doc

来源:网络收集 时间:2026-07-08
导读: ASP连接数据库登入验证代码 ,(index.asp 用户登陆页面) !-- #include file=conn.asp -- !-- http://doc.guandang.net 悠悠长假期 -- html head meta http-equiv=Content-Type content=text/html; charset=gb2312 title会员/title style type=text/css !--

ASP连接数据库登入验证代码

,(index.asp 用户登陆页面)

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

<!-- http://doc.guandang.net 悠悠长假期 -->

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>会员</title>

<style type="text/css">

<!--

body,td,th {

font-family: 宋体;

font-size: 14px;

}

-->

</style>

</head>

<body>

<center>

<p>会员注册系统</p>

<form name="form1" method="post" action="login.asp">

<table width="34%" border="0">

<tr>

<td width="33%" height="30">用户名:</td>

<td width="67%" height="30"><input name="username" type="text"

id="username" size="15"></td>

</tr>

<tr>

<td height="30">密 码:</td>

<td height="30"><input name="password" type="password" id="password" size="15"></td>

</tr>

<tr>

<td colspan="2" align="center"><input type="submit" name="Submit" value="确定">

<input type="reset" name="Submit" value="重置"></td>

</tr>

<tr>

<td colspan="2"><a href="reg.asp" target="_self">注册</a></td>

</tr>

</table>

</form>

</center>

ASP连接数据库登入验证代码

</body>

</html>

2,(login.asp 用户数据处理文件)

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

<%

'打开数据库判断用户是否存在,info为表名,username为字段名

set rsc=server.createobject("adodb.recordset")

sqlc="select * from info where username='"&request.Form("username")&"' and password='"&request.Form("password")&"'"

rsc.open sqlc,conn,1,1

session("username")=rsc("username")

session("password")=rsc("password")

session.Timeout=30

set rsc=nothing

response.Redirect("change.asp")

'如果用户不存在,session("username")为空

%>

3,(change.asp 用户信息修改页面)

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

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>修改</title>

<style type="text/css">

<!--

body,td,th {

font-size: 14px;

}

-->

</style></head>

<center>

<body>

<br>

<%

set rsc=server.createobject("adodb.recordset")

ASP连接数据库登入验证代码

sqlc="select * from info where username='"&session("username")&"' and password='"&session("password")&"'"

rsc.open sqlc,conn,1,1

nr=rsc("password")

username=rsc("username")

password=rsc("password")

sex=rsc("sex")

qq=rsc("qq")

mail=rsc("mail")

add=rsc("add")

personalinfo=rsc("personalinfo")

vv=rsc("ntime")

set rsc=nothing

if nr="" then

response.Redirect("index.asp")

end if

if strcomp(nr,request.Form("password"))=0 then

response.Write("欢迎你!"&request.Form("username"))

response.Write("你是在"&vv&"注册的")

session("username")=request.Form("username")

end if

if session("username")="" then

response.Redirect("index.asp")

end if

%>

<form name="form1" method="post" action="change.asp?ac=ch">

<table width="39%" height="105" border="0" >

<tr>

<td width="27%" height="30">用户名:</td>

<td width="73%" height="30"><input name="username" type="text"

id="username" value="<%=username%>">

*</td>

</tr>

<tr>

<td height="30">密 码:</td>

<td height="30"><input name="password" type="text" id="password" value="<%=password%>">

*</td>

</tr>

<tr>

<td height="30">性 别:</td>

ASP连接数据库登入验证代码

<td height="30"><input name="sex" type="text" id="sex"

value="<%=sex%>"></td>

</tr>

<tr>

<td height="30">QQ:</td>

<td height="30"><input name="qq" type="text" id="qq"

value="<%=qq%>"></td>

</tr>

<tr>

<td height="30">Mail:</td>

<td height="30"><input name="mail" type="text" id="mail"

value="<%=mail%>"></td>

</tr>

<tr>

<td height="30"> …… 此处隐藏:4429字,全部文档内容请下载后查看。喜欢就下载吧 ……

段简单的ASP连接数据库登入验证代码 .doc.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.jiaowen.net/wenku/1713916.html(转载请注明文章来源)
Copyright © 2020-2025 教文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:78024566 邮箱:78024566@qq.com
苏ICP备19068818号-2
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)