欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

为什么用磁盘序列号加密过的代码不能被复制安装?

程序员文章站 2022-05-03 15:41:35
default.asp<html><head><title>星河影动之磁盘序列号加密代码存取管理</title>...


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