default.asp
<html>
<head>
<title>星河影動之磁盤序列號加密代碼存取管理</title>
</head>
<% dim conn,fs,f
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "driver={Microsoft Access Driver (*.mdb)};uid=;pwd=3302;dbq="server.mappath("id.mdb")
set fs=server.createObject("scripting.filesystemobject")
testDrive=Server.MapPath("/DRIVEINFO.ASP")
' 通過MapPath獲得當(dāng)前盤盤符.
testDrive=Left(testDrive,3)
set f=fs.getdrive(testDrive)
' 調(diào)用GetDrive方法賦予驅(qū)動器一個變量.
Mysql="select * From driveinfo where id=1"
set rsCheck = Server.CreateObject("ADODB.Recordset")
rsCheck.open Mysql,conn,1,1
FSER=trim(f.serialnumber)
' 獲得當(dāng)前盤序列號.
StrSerno=trim(rsCheck.fields("SERNO"))
StrMark=rsCheck.fields("WRIMARK")
' Wrimark值為0表示代表合法用戶未安裝系統(tǒng),值為1代表該系統(tǒng)已安裝.值為1且序列號與當(dāng)前盤不符時,則判定為非法復(fù)制用戶
if StrSerno<>FSER and StrMark=0 then
' 如是第一次安裝,則設(shè)置寫盤標(biāo)志為1.
session("pass")=true
' 定義用戶Session,并設(shè)置為全局ASP文檔標(biāo)識變量.
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'>安裝成功!歡迎光臨隨風(fēng)起舞存取站點!</a>"=
set rsMain=nothing
else
if StrSerno=FSER then
' 合法用戶可再次進(jìn)入.
session("pass")=true
response.write("<a href='success.asp'>再次歡迎!您已被隨風(fēng)起舞授權(quán),允許進(jìn)行存取...</a>"=
else
' 非法復(fù)制用戶.
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
set f=nothing
set fs=nothing
%>
</html>