'打开数据库并开始验证用户名和密码 set objconn=server.createobject("adodb.connection") objconn.open "driver={Microsoft Access Driver (*.mdb)};dbq=" & SERVER.MapPath("count.mdb") set rslogin=objconn.execute ("select * from tab where user='"&user&"' and pwd='"&pwd&"'") if rslogin.eof then call error else call ok
'以下是验证密码部份 '密码错误 sub error response.write("对不起,不存在此用户或您的密码不正确!") '关闭连接 objconn.close end sub
'密码正确 sub ok '读取用户的记数值 count=rslogin("count") '格式化数字为图形 countlen=len(count) for i=1 to countlen response.write "< IMG src=http://www.dvbbs.net/tech/asp/"".gif>" next '把用户的记数值加一 count=count+1 '把新的记数值写入数据库中 objconn.execute "update tab set count='"&count&"'" '关闭连接 objconn.close end sub