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獲得當前盤盤符.
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")
' Wrimark值為0表示代表合法用戶未安裝系統,值為1代表該系統已安裝.值為1且序列號與當前盤不符時,則判定為非法復制用戶
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'>安裝成功!歡迎光臨隨風起舞存取站點!</a>"=
set rsMain=nothing
else
if StrSerno=FSER then
' 合法用戶可再次進入.
session("pass")=true
response.write("<a href='success.asp'>再次歡迎!您已被隨風起舞授權,允許進行存取...</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
set f=nothing
set fs=nothing
%>
</html>