足球游戏_中国足彩网¥体育资讯$

asp用户注册示例代码
来源:易贤网 阅读:593 次 日期:2014-10-27 14:29:53
温馨提示:易贤网小编为您整理了“asp用户注册示例代码”,方便广大网友查阅!

asp用户注册示例代码:

数据库设计:

表名:userinfo

字段名 类型/长度 说明

id 自动编号 用户id

username text/16 用户名

password text/32 md5 32位加密

addtime 时间日期 注册时间

代码如下:

<%

'asp教程用户注册示例

'http://www.asp.org.cn

dim db,conn,myconn

db=asporgcn.mdb '数据库文件相对路径

set conn = server.createobject(adodb.connection) '创建对象实例

myconn=provider=microsoft.jet.oledb.4.0;data source= & server.mappath(&db&)

conn.open myconn

if request(submit)<> then '用户点击提交按钮

username=request(username)

password=request(password)

password2=request(password2)

if password<>password2 then

response.write(<script>alert('两次输入的密码不对');window.history.back();</script>)

response.end() '结束运行

end if

set rs=server.createobject(adodb.recordset)

sql=select count(0) from userinfo where username='&username&'

rs.open sql,conn,1,1

if rs(0)>0 then '判断用户名是否已经注册

response.write(<script>alert('用户名已经存在');window.history.back();</script>)

response.end() '结束运行

else

'response.write insert into userinfo(username,password) values('&username&','&password&')

conn.execute(insert into userinfo([username],[password]) values('&username&','&password&')) '添加到数据库注册完成,password是access中的保留关键字。保留关键字用[]括起来就不会出错。

response.write(<script>alert('注册成功!');window.history.back();</script>)

end if

rs.close

set rs=nothing '使用完rs后一定要记得关闭与释放,否则占用服务器资源,在asp程序面试时,这一点一定要记住

end if

conn.close '关闭连接,

set conn=nothing '释放内存 这两句很重要,不然会占用大量服务器资源。

%>

<html>

<head>

<title>用户注册案例</title>

<meta content=中国asp网编写的用户注册案例教程。http://www.asp.org.cn name=description>

</head>

<body>

<form id=form1 name=form1 method=post action=index.asp>

<table width=400 border=1>

<tr>

<td>用户名:</td>

<td><label>

<input name=username type=text id=username size=16 maxlength=16 />

</label></td>

</tr>

<tr>

<td>密码:</td>

<td><input name=password type=password id=password size=16 maxlength=16 /></td>

</tr>

<tr>

<td>确认密码:</td>

<td><input name=password2 type=password id=password2 size=16 maxlength=16 /></td>

</tr>

<tr>

<td colspan=2><label>

<input type=submit name=submit value=提交 />

</label></td>

</tr>

</table>

</form>

</body>

</html>

中国足彩网信息请查看IT技术专栏

中国足彩网信息请查看网络编程
易贤网手机网站地址:asp用户注册示例代码
由于各方面情况的不断调整与变化,易贤网提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!
关于我们 | 联系我们 | 人才招聘 | 网站声明 | 网站帮助 | 非正式的简要咨询 | 简要咨询须知 | 加入群交流 | 手机站点 | 投诉建议
工业和信息化部备案号:滇ICP备2023014141号-1 足球游戏_中国足彩网¥体育资讯$ 滇公网安备53010202001879号 人力资源服务许可证:(云)人服证字(2023)第0102001523号
云南网警备案专用图标
联系电话:0871-65317125(9:00—18:00) 获取招聘考试信息及咨询关注公众号:hfpxwx
咨询QQ:526150442(9:00—18:00)版权所有:易贤网
云南网警报警专用图标