利用硬盘驱动器号制作防扩散FOXPRO程序
一、设置合法使用者硬盘驱动器程序SET.PRG
二、检测运行程序的当前硬盘驱动器号TEST.PRG
***SET.PRG***
SET TALK OFF
!DIR >N.TXT
USE DRIVE.DBF
ZAPAPPE FROM N.TXT SDF
DELE FILE N.TXT
***TEST.PRG***
SET TALK OFF
USE DRIVE
COPY TO DRIVTTMP
GO 3
A=RIGH(ALLT(DRIVE),LEN(ALLT(DRIVE))-24)
USE DRIVETMP
ZAP
!DIR >N.TXT
APPE FROM N.TXT SDF
GO 3
B=RIGH((ALLT(DRIVE),LEN(ALLT(DRIVE)-24)
DELE FILE N.TXT
DELE FILE DRIVETMP.DBF
IF A=B
SET COLOR TO /N
@10,36 CLEAR TO 13,54
SET COLOR TO +G/GB
@11,38 CLEAR TO 14,56
@12,40 SAY `您为合法用户,'
@13,40 SAY `按任意键继续……'
S=INKEY(0)
DO MAIN
ELSE
SET COLOR TO /N
@10,36 CLEAR TO 13,54
SET COLOR TO +G/R
@11,38 CLEAR TO 14,56
@12,40 SAY `您为非法用户,'
@13,40 SAY `按任意键继续……'
S=INKEY(0)
QUIT
ENDIF
备注:1.程序中涉及的数据库DRIVE.DBF与DRIVETMP.DBF结构为‘DRIVE.C 50'DRIVETMP.DBF为过渡数据库,DRIVE.DBF为存放硬盘驱动信息的数据库。2.程序设MAIN.PRG为用户的主程序。