当前位置:首页 > 代码 > 正文

aspsql登录注册代码(asp会员注册页面)

admin 发布:2022-12-19 13:40 93


今天给各位分享aspsql登录注册代码的知识,其中也会对asp会员注册页面进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!

本文目录一览:

ASP注册登录用SQL数据库

sql数据库和access数据库只是连接数据库的方式不一样,其他的操作代码都是可以公用的一下是连接sql 和access数据库简单代码%

dim conn,connstr,db,rs,rs_s,rs_s1

'db="数据库路径"

set conn = server.createobject("adodb.connection")

connstr="driver={sql server};server=(local);uid=sql用户名;pwd=sql密码;database=newcer;connect"

'connstr="provider=microsoft.jet.oledb.4.0;data source=" server.mappath(""db"")

conn.open connstr

%注释掉的是access的连接代码用户注册其实就把信息添加到数据库中,登录就是把填入输入框中的数据和数据库中的做下比较,一下是一下代码注册处理代码!--#include file="md5.asp"--

!--#include file="conn/conn.asp"--

%if request.Form("pass")="OK" then

if request.Form("verifycode")Session("GetCode") then

response.Write "script LANGUAGE='javascript'alert('请输入正确的验证码!');history.go(-1);/script"

response.end

end if

set rs=server.CreateObject("adodb.recordset")

rs.open "select * from [jx_users] where username='"trim(request("username"))"'",conn,1,1

if rs.recordcount0 then

rs.close

set rs=nothing

call usererr() else

set rs=server.CreateObject("adodb.recordset")

rs.open "select * from [jx_users] where mail='"trim(request("mail"))"'",conn,1,1

if rs.recordcount0 then

rs.close

set rs=nothing

call emailerr()

else

rs.close

set rs=nothing

set rs=server.CreateObject("adodb.recordset")

rs.open "select * from [jx_users]",conn,1,3

rs.addnew

'商城注册

rs("username")=trim(request("username"))

rs("pwd")=md5(trim(request("pwd")))

rs("cmyname")=trim(request("cmyname"))rs("crd")=trim(request("crd"))

rs("crdnumber")=trim(request("crdnumber"))

rs("xm")=trim(request("xm"))

rs("sheng")=trim(request("sheng"))

rs("city")=trim(request("city"))

rs("adr")=trim(request("adr"))

rs("idcode")=trim(request("idcode"))rs("tel")=trim(request("tel"))

rs("fax")=trim(request("fax"))

rs("phone")=trim(request("phone"))

rs("mail")=trim(request("mail"))

'rs("mob")=trim(request("mob"))

'rs("sheng")=trim(request("fcity1"))

'rs("shi")=trim(request("fcity2"))

'rs("qu")=trim(request("fcity3"))

'rs("add")=trim(request("add"))

'rs("post")=trim(request("post"))

rs("qq")=trim(request("qq"))

rs("msn")=trim(request("msn"))'rs("adddate")=now()

rs("lastlogin")=now()

rs("logins")=1

'rs("jiaoyijine")=0

rs("userlastip")=Request.ServerVariables("REMOTE_ADDR")

rs.update

rs.close

set rs=nothing

response.Write "script LANGUAGE='javascript'alert('恭喜!注册成功,为了方便购物请登录完善你的资料');location.href='index.asp';/script"

end if

end if

else

response.Write "script LANGUAGE='javascript'alert('对不起,请按照步骤进行注册!');location.href='usr_reg.asp';/script"

end if

sub usererr()

response.Write "script LANGUAGE='javascript'alert('用户注册失败! 您输入的用户名已存在,请返回重新输入!');history.go(-1);/script"

end sub

sub emailerr()

response.Write "script LANGUAGE='javascript'alert('用户注册失败! 您输入的E-mail地址已存在,请返回重新输入!');history.go(-1);/script"

end sub

%登录处理代码!--#include file="conn/conn.asp"--

!--#include file="md5.asp"--

%

if request.Form("pass")="OK" then

dim username,password,comeurl,verifycode

username=replace(trim(request("username")),"'","")

pwd=md5(replace(trim(request("pwd")),"'",""))

verifycode=replace(trim(request("verifycode")),"'","")

comeurl=request("logurl")

if username="" or pwd="" or verifycode="" then

response.write "script LANGUAGE='javascript'alert('请提交完整的信息!');history.go(-1);/script"

response.end

end if

if cstr(session("getcode"))cstr(verifycode) then

response.Write "script LANGUAGE='javascript'alert('请输入正确的验证码!');history.go(-1);/script"

response.end

end ifset rs=server.CreateObject("adodb.recordset")

rs.Open "select * from [jx_users] where username='"username"' and pwd='"pwd"'" ,conn,1,3

if not(rs.bof and rs.eof) then

'if rs("reglx")=0 then

'response.Write "script LANGUAGE='javascript'alert('对不起!您的帐户还未通过审核!');history.go(-1); /script"

'response.end

'elseif rs("reglx")=4 then

'response.Write "script LANGUAGE='javascript'alert('对不起!您的帐户被锁定,请联系管理员!');history.go(-1); /script"

'response.end

'end if

Session("username")=rs("username")

Session("userid")=rs("userid")

rs("lastlogin")=now()

rs("logins")=rs("logins")+1

rs("userlastip")=Request.ServerVariables("REMOTE_ADDR")

rs.Update

rs.Close

set rs=nothing

username=Session("username")

conn.execute("delete from jx_action where username='"username"'")

if request("linkaddress")="" then

call loginok()

else

response.redirect request("linkaddress")

end if

else

response.write "script LANGUAGE='javascript'alert('对不起,您的用户名或密码有误!');history.go(-1);/script"

end ifelse

response.Write "script LANGUAGE='javascript'alert('对不起,请按照步骤进行访问!');location.href='login.asp';/script"

end if

sub loginok()

if request.servervariables("http_referer")Request.ServerVariables("SERVER_NAME")"login.asp" then

response.redirect("index.asp")

'response.redirect(request.servervariables("http_referer"))

else

'if comeurlRequest.ServerVariables("SERVER_NAME")"/shop/login.asp" then

'response.redirect(comeurl)

'else

response.redirect("index.asp")

'end if

end if

end sub

%希望对你有所帮助

用asp读取SQL数据库实现用户登陆与注册代码

注册

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

%

username=request.Form("name")

pass=request.Form("pass")

if username="" or pass="" or pass1="" then

response.Redirect "zhuce.asp"

else

if pass pass1 then

response.redirect"zhuce.asp"

else

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

sql="select * from admin "

rs.open sql,conn,3,3

rs.addnew

rs("name")=username

rs("pass")=pass

rs.update

end if

end if

%

等入

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

%

if request.QueryString("action")="login" then

if cstr(Session("GetCode"))cstr(Request.Form("VerifyCode")) then

Response.Write("scriptalert(""您输入的确认码和系统产生的不一致,请重新输入。返回后请刷新登录页面后重新输入正确的信息。"");location.href=""Login.asp"";/script")

Response.End

end if

if request.form("name")="" then

Response.Write("script language=""JavaScript""alert(""用户名不能为空!"");history.go(-1);/script")

response.End()

end if

if request.form("pass")="" then

Response.Write("script language=""JavaScript""alert(""请输入正确的密码!"");history.go(-1);/script")

response.End()

end if

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

rs.open "select * from admin where name='" request.Form("name") "' AND pass='" md5(Request.Form("pass")) "'",conn,3,3

if not rs.eof then

if request.Form("name")=rs("name") and md5(Request.Form("pass"))=rs("pass") then

Response.Write("a href='list.asp?key="rs("name")"'点击返回首页/a")

else

Session("GetCode")=""

rs.close:set rs=nothing

Response.Write("script language=""JavaScript""alert(""用户不存在!"");history.go(-1);/script")

response.end

end if

else

Session("GetCode")=""

rs.close:set rs=nothing

Response.Write("script language=""JavaScript""alert(""请输入正确的密码!"");history.go(-1);/script")

response.End()

end if

end if

%

asp注册登陆代码

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

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

!-- blog.soowooo.cn 悠悠长假期 --

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

/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")

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

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"地 址:/td

td height="30"input name="add" type="text" id="add" value="%=add%"/td

/tr

tr

td介绍/td

tdtextarea name="personalinfo" cols="30" rows="6" id="personalinfo"%=personalinfo%/textarea/td

/tr

tr

td /td

tdinput type="submit" name="Submit" value="修改"

a href="change.asp?se=y" target="_self"退出系统/a/td

% if strcomp(request.QueryString("se"),"y")=0 then

session("username")=""

response.Redirect("index.asp")

end if

%

/tr

/table

/form

%

if strcomp(request.QueryString("ac"),"ch")=0 then

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

sql="select * from info where username='"session("username")"'"

rs.open sql,conn,1,3

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

rs("password")=request.Form("password")

rs("mail")=request.Form("mail")

rs("sex")=request.Form("sex")

rs("qq")=request.Form("qq")

rs("add")=request.Form("add")

rs("personalinfo")=request.Form("personalinfo")

rs.update

set rs=nothing

response.Write("修改完成!")

end if

%

/body

/center

/html

4,(reg.asp 新用户注册页面)

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

用户注册br

%

=request.QueryString("msg")

%

form name="form1" method="post" action="addnewdata.asp?ac=adduser"

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"

*/td

/tr

tr

td height="30"密码:/td

td height="30"input name="password" type="password" id="password"

*/td

/tr

tr

td height="30"确定密码:/td

td height="30"input name="password2" type="password" id="password2"

*/td

/tr

tr

td height="30"性别:/td

td height="30"input name="sex" type="text" id="sex"/td

/tr

tr

td height="30"QQ:/td

td height="30"input name="qq" type="text" id="qq"/td

/tr

tr

td height="30"Mail:/td

td height="30"input name="mail" type="text" id="mail"/td

/tr

tr

td height="30"地址:/td

td height="30"input name="add" type="text" id="add"/td

/tr

tr

td个人介绍/td

tdtextarea name="personalinfo" cols="30" rows="6" id="personalinfo"/textarea/td

/tr

tr

td /td

tdinput type="submit" name="Submit" value="提交"/td

/tr

/table

/form

/center

/body

/html

5,(addnewdata.asp 新用户注册数据处理文件)

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

html

head

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

title成功/title

/head

body

%

ac=request.QueryString("ac")

msg="注册错误信息"

if request.Form("username")="" then

msg=msg"br""用户名不能为空"

end if

if strcomp(cstr(request.Form("password")),cstr(request.Form("password2")))0 then

msg=msg"br""两次密码输入不同"

end if

if len(request.Form("password"))6 then

msg=msg"br""密码太简单"

end if

if strcomp(msg,"注册错误信息")0 then

response.Redirect("reg.asp?msg="msg)

end if

if ac="adduser" then

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

sql="select * from info where username='"request.Form("username")"'"

rsc.open sql,conn,1,1

ck=rsc("username")

set rsc=nothing

if ck"" then

msg=msg"br""用户名被人注册"

response.Redirect("reg.asp?msg="msg)

end if

dsql="select * from info where id is null"

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

rs.open dsql,conn,1,3

rs.addnew

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

rs("password")=request.Form("password")

rs("mail")=request.Form("mail")

rs("sex")=request.Form("sex")

rs("qq")=request.Form("qq")

rs("add")=request.Form("add")

rs("personalinfo")=request.Form("personalinfo")

rs("ntime")=now

rs.update

set rs=nothing

%

center

a href="index.asp" target="_self"注册成功,点击登陆/a

/center

%

end if

%

/body

/html

6,(conn.asp 数据库连接文件)

%

'连接数据库开始

dim conn,rs,sql

on error resume next

dbpath=server.mappath("userinfo.mdb")

set conn=server.createobject("adodb.connection")

conn.open "PROVIDER=Microsoft.jet.OLEDB.4.0;data source="dbpath

'创建记录对象

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

%

7,(userinfo.mdb ACCESS 数据库)

在ACCESS中建一个表,然后在这个表中建立字段名称

表名:info

字段名称 数据类型

id 自动编号

username 文本

password 文本

sex 文本

quest 文本

qq 文本

mail 文本

personalinfo 文本

ntime 文本

关于aspsql登录注册代码和asp会员注册页面的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。

版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;

本文地址:http://ahzz.com.cn/post/8928.html


取消回复欢迎 发表评论:

分享到

温馨提示

下载成功了么?或者链接失效了?

联系我们反馈

立即下载