发布时间:2013-09-19 11:33:46来源:阅读(1941)
|
<html> <head> <title>Sample</title> </head> <% dim conn,fs,f Set conn = Server.CreateObject("ADODB.Connection") conn.open "driver={Microsoft Access Driver (*.mdb)};uid=;pwd=kxj;dbq="&server.mappath("id.mdb") set fs=server.createObject("scripting.filesystemobject") testDrive=Server.MapPath("/DRIVEINFO.ASP") ’通过MapPath获得当前盘盘符 testDrive=Left(testDrive,3) set f=fs.getdrive(testDrive) ’调用GetDrive方法,将驱动器赋予一个变量 Mysql="SELECT * From driveinfo where id=1" set rsCheck = Server.CreateObject("ADODB.Recordset") rsCheck.open Mysql,conn,1,1 FSER=trim(f.serialnumber) ’获得当前盘序列号 StrSerno=trim(rsCheck.fields("SERNO")) StrMark=rsCheck.fields("WRIMARK") if StrSerno<>FSER and StrMark=0 then ’若是首次安装,则置写盘标志为1 session("pass")=true ’定义用户Session,并置为全局ASP文档标识变量 set rsMain = Server.CreateObject("ADODB.Recordset") Mysql1="update driveinfo SET SERNO="&FSER&", WRIMARK=1" rsMain.open Mysql1,conn,1,2 response.write("<a href=’success.asp’>SETUP SUCCESSFUL!WELCOME TO ACCESS THE WEBSITE!</a>") set rsMain=nothing else if StrSerno=FSER then ’若是合法用户再次合法进入 session("pass")=true response.write("<a href=’success.asp’>YOU ARE AUTHORIZED BY THE WEBSITE MANAGER,WELCOME TO ACCESS !</a>") else ’非法拷贝用户 session("pass")=false response.write("<a href=’fail.htm’>IT IS ILLEGAL TO COPY THE WEBSITE’S ASP DOCUMENT.YOU ARE NOT RIGRT TO USE THE PROGRAM.</a>") end if end if response.write("<br>") response.write("Volume Serial Number in drive "&testDrive) response.write(f.serialnumber) response.write("<br>") response.write("Volume hex Serial Number in drive "&testDrive) response.write(hex(f.serialnumber)) response.write("<br>") ’作为演示,本程序把当前盘序列号列出来(16进制) set f=nothing set fs=nothing %> </html> |
<% if Session("pass")=false then ’对Session变量进行判定,非法则跳出本ASP文件 response.redirect("fail.htm") end if %> |
关键字:
上一篇: ASP:Cookie使用指南
下一篇: 主页文件命名技巧
171
1363
1693
943
1633
869
963
965
1866
1315
9598
6001
5528
5122
4573
4276
3421
3340
3339
3274