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

ecshop调用代码结构(ecshop开发手册)

admin 发布:2022-12-19 21:25 153


本篇文章给大家谈谈学生用户注册asp代码,以及asp实现用户注册登录代码对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

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="

'创建记录对象

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

%

7,(userinfo.mdb ACCESS 数据库)

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

表名:info

字段名称 数据类型

id 自动编号

username 文本

password 文本

sex 文本

quest 文本

qq 文本

mail 文本

personalinfo 文本

ntime 文本

ASP登陆代码

1、判断部分

script language="javascript"

!--

function isok(theform)

{

if (theform.user_name.value.length2 || theform.user_name.value.length10)

{

alert("学生姓名请填写真实姓名!");

theform.user_name.focus();

return (false);

}

if (theform.password.value.length3 || theform.password.value.length10)

{

alert("密码最少要3位,最多10位! !");

theform.password.focus();

return (false);

}

if (theform.password_two.value=="")

{

alert("你还有确认密码没填呢!");

theform.password_two.focus();

return (false);

}

if (theform.password_two.value!=theform.password.value)

{

alert("两次密码怎么不一样!");

theform.password_two.focus();

return (false);

}

if (theform.userclass.value=="")

{

alert("你所在的专业班级还没填呢!");

theform.userclass.focus();

return (false);

}

if (theform.num.value=="")

{

alert("你的学生证号还没填呢!");

theform.num.focus();

return (false);

}

return (true);

}

--

/script

2、接受数据的表单部分

form name="form1" method="post" action="userregcheck.asp" onSubmit="return isok(this)"

input name="user_name" type="text" id="user_name" title="请输入您的姓名" size="15"

/label/td

/tr

tr

tddiv align="center"登陆密码:/div/td

tdinput name="password" type="password" id="password" title="请输入您的密码" size="15"/td

/tr

tr

tddiv align="center"重输密码:/div/td

tdinput name="password_two" type="password" id="password_two" size="15"/td

/tr

tr

tddiv align="center"专业班级:/div/td

tdlabel

input name="userclass" type="text" id="userclass" size="15"

/label/td

/tr

tr

tddiv align="center"学生证号:/div/td

tdlabel

input name="num" type="text" id="num" size="15"

/label/td

/tr

/table

center

pbr /

input type="submit" name="submit" value="确认提交" /

input type="reset" name="reset" value="重新输入" /

input type="button" name="button" value="返回首页" onClick=" history.back()" /

/p

/center

/form

3、数据验证保存到数据库部分

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

%

user_name =left(request("user_name"),15)

password =left(request("password"),15)

userclass =left(request("userclass"),15)

num =left(request("num"),15)

if password="" then

response.write "数据有错!"

response.end

end if

Set rs = Server.CreateObject("adodb.recordset")

sql="select * from user where username like '" user_name "'"

rs.open sql,conn,1,3

if rs.eof and rs.bof then

rs.addnew

rs("username")=user_name

rs("userpwd")=password

rs("userclass")=userclass

rs("usernum")=num

rs.update

rs.movelast

session("user_id")=rs("userid")

session("name")=rs("username")

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

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

rs2.open sql,conn,1,3

rs2("onlinetime")=now

rs2("userip")=Request.serverVariables("REMOTE_ADDR")

rs2.update

session("userip") = rs2("userip")

rs.close

response.redirect "index1.asp"

response.end

else

%

a href="userreg.asp"[重新注册]/a

%end if%

有问题可以直接联系我啊

ASP注册代码问题

你可以用JS在前台验证,如果实在想用VBS验证的话,你处理的页面只需要一个就行了,也不需要onsubmit="chkfields()" 这段代码了,只要在处理页面加上判断就行了,比如if request.form("user")="" or request.form("pwd")="" then

response.write("sscript language=javascriptalert("用户名和密码不能为空");window.location='regzc.asp'/script")

elseif

……(继续判断的代码)

elseif

处理完全符合条件的注册代码

end if

高分求助~~注册网页部分ASP代码解释

!--将conn.asp和webconfig.asp两文件包含进本页--

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

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

%

'让变量action接收到收URL传来的变量action的值

'如下面form表单的action="reg.asp?action=save" 里的“save”

action=request.QueryString("action")

%

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

STYLE type=text/css

%

'开始select条件选择

select case action

'如果传来的action的值为空,就执行以下HTML代码,也就是显示用户注册的表单

case ""

%

/STYLE

div align="center"

table width="770" border="0" cellpadding="0" cellspacing="1" bgcolor="#B4B4B4"

td height="78" valign="top" bgcolor="#ffffff"br

div align="center"

table width="100%" border="0" cellpadding="0" cellspacing="0"

td height="18" bgcolor="#ffffff"div align="center"bfont size=2%=webname%注册条约

td bgcolor="#ffffff" table width="90%" border="0" align="center" cellpadding="0" cellspacing="0"

div align="center"

table width="770" border="0" cellpadding="0" cellspacing="1" bgcolor="#B4B4B4"

td height="230" bgcolor="#ffffff"div align="center"

font color="#CC0000"请填写用户注册信息 /font

div align="center"

table width="100%" border="0" cellpadding="2" cellspacing="1"

form name="userinfo" method="post" action="reg.asp?action=save"

input name="useremail" type="text" id="useremail" value="@" size="25" style="font-size: 9pt"

font color="#FF0000"**/font请填写您有效的邮件地址br

td class=pad bgcolor="#ffffff"font color="#CC0000"用 户 名:

input name="username" type="text" id="username" size="14" style="font-size: 9pt"

input name="userzhenshiname" type="text" id="userzhenshiname" size="14" style="font-size: 9pt"

/fontfont color="#FF0000"**/font以便发货确认font color="#cb6f00"br

%

'如果action的值为save,那就么将md5.asp这个文件包含进来

case "save"

%

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

%

'调用名为saveuser的这个函数

call saveuser()

'结束select选择

end select

%

!--将service.asp和copyright.asp两文件包含进本页--

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

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

%

'创建一个名为tiaoyue的过程(函数)

sub tiaoyue()

'创建一个名为rs的记录集对象

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

'rs打开,查询出数据库的shop_config表中regtiaoyue字段的内容

rs.Open "select regtiaoyue from shop_config",conn,1,1

'将shop_config表中regtiaoyue字段的内容输出到网页中

response.Write trim(rs("regtiaoyue"))

'关闭rs记录集

rs.Close

'从内存中将rs记录集对象释放掉

set rs=nothing

'创建一个名为rs的记录集对象

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

'查询数据库user表中username或useremail与表单传来的相同的username和useremail字段的内容

rs.open "select username,useremail from [user] where username='"trim(request("username"))"' or useremail='"trim(request("useremail"))"'",conn,1,1

'如果指针未到记录集的末尾也未到记录集的最前端(就表示数据库中有符合与上SQL查询条件相吻合的记录)

if not rs.eof and not rs.bof then

'调用名为usererr的过程(函数)

call usererr()

'用可以写入数据库的方式打开数据库里的user表

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

'用rs对象进行新的数据输入

rs.addnew

'在新输入的记录中

'让username字段的值等于表单传来的username的值

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

'让userpassword字段的值等于表单传来的将通过md5加密的userpassword1的值

rs("userpassword")=md5(trim(request("userpassword1")))

'下面这几句与上两句意思相同

rs("useremail")=trim(request("useremail"))

rs("quesion")=trim(request("quesion"))

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

rs("userzhenshiname")=trim(request("userzhenshiname"))

'这里还少写了句:rs.update

'释放rs对象

set rs=nothing

'创建一个名为bookshop的COOKIE对象,并将其子键username的值等于表单传来的username的值

response.Cookies("bookshop")("username")=trim(request("username"))

'让bookshop这个COOKIE记录的有效期设置为当前天数加1(也就是说此COOKIE一天后过期)

response.Cookies("bookshop").expires=date+1

'让名为regtimes的session对象的值等于1

session("regtimes")=1

'设置当前用户的session在1分钟后过期

session.Timeout=1

'在当前页面中打印输出表格……

response.Write "table width=776 border=0 align=center……"

……

%

------------------------------------------------------------------------------------------

这些代码中,还有几个地方有误,需修改 :)

学生用户注册asp代码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于asp实现用户注册登录代码、学生用户注册asp代码的信息别忘了在本站进行查找喔。

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

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


取消回复欢迎 发表评论:

分享到

温馨提示

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

联系我们反馈

立即下载