那就是做代理了
在软件里加注册机制吧,一般做法都用识别硬盘序列号
因为这样电脑再升级机器都认识
这样就保证了每台机器只能装一套
这是我的一个很简陋的加密算法没什么参考意义
你看怎么取硬盘序列号就是了
//以下是取硬盘序列号过程
procedure Tfmmain.Timer1Timer(Sender: TObject);
var
DSSER,dsser1,dsser2,dsser3:string;
mp,i,lc:integer;
a1,s:array [0..25] of string;
SerialNum : dword;
aX, bX : dword;
Buffer : array [0..255] of char;
begin
CSER:='';
while CSER='' do
begin
IF GetVolumeInformation('c:/', Buffer, SizeOf(Buffer), @SerialNum, aX, bX, nil, 0) then
CSER:=IntToStr(SerialNum);
end;
//以下是注册窗口的代码也就是加解密算发 没什么多大意义只是喝喝一般人
你自己写算法吧,可以将ASC编号上做运算这里就不多说了,再加一串随机哄人
随机数所在的位数要根据序列号变才能喝住人的,以下的看了也没多大用最多笑话
我一下.还是让别人买断比较好一些,
unit ureg;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Mask, DBCtrls, wtjDBEdit,tables,MAIN,wel;
type
Tfmreg = class(TForm)
userco: TwtjDBEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
reged: TwtjDBEdit;
okbt: TButton;
cabt: TButton;
Label4: TLabel;
noed: TwtjDBEdit;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Button1: TButton;
procedure formshow(Sender: TObject);
procedure okbtClick(Sender: TObject);
procedure cabtClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure usercoExit(Sender: TObject);
procedure noedExit(Sender: TObject);
procedure FormClose(Sender: TObject;
var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
fmreg: Tfmreg;
serino:string;
nnn:boolean;
implementation
uses login;
{$R *.DFM}
procedure Tfmreg.formshow(Sender: TObject);
var
DSSER,dsser1,dsser2,dsser3:string;
mp,i,lc:integer;
a1,s:array [0..25] of string;
begin
dm1.tbreg.Open;
lc:=length(CSER);
//第一种情况;
dsser1:='';
mp:=0;
for i:=1 to lc do
begin
a1
:=copy(Cser,i,1);
s:='7';
if (a1='0') and (mp=0) then
s:='A';
if (a1='1') and (mp=1) then
s:='B';
if (a1='2') and (mp=2) then
s:='C';
if (a1='3') and (mp=0) then
s:='D';
if (a1='4') and (mp=1) then
s:='E';
if (a1='5') and (mp=2) then
s:='F';
if (a1='6') and (mp=0) then
s:='G';
if (a1='7') and (mp=1) then
s:='H';
if (a1='8') and (mp=2) then
s:='I';
if (a1='9') and (mp=0) then
s:='J';
if (a1='0') and (mp=1) then
s:='K';
if (a1='1') and (mp=2) then
s:='L';
if (a1='2') and (mp=0) then
s:='M';
if (a1='3') and (mp=1) then
s:='N';
if (a1='4') and (mp=2) then
s:='O';
if (a1='5') and (mp=0) then
s:='P';
if (a1='6') and (mp=1) then
s:='Q';
if (a1='7') and (mp=2) then
s:='R';
if (a1='8') and (mp=0) then
s:='S';
if (a1='9') and (mp=1) then
s:='T';
if (a1='0') and (mp=2) then
s:='U';
if (a1='1') and (mp=0) then
s:='V';
if (a1='2') and (mp=1) then
s:='W';
if (a1='3') and (mp=2) then
s:='X';
if (a1='4') and (mp=0) then
s:='Y';
if (a1='5') and (mp=1) then
s:='Z';
if (a1='6') and (mp=2) then
s:='3';
if (a1='7') and (mp=0) then
s:='4';
if (a1='8') and (mp=1) then
s:='5';
if (a1='9') and (mp=2) then
s:='6';
dsser1:=dsser1+s;
end;
//第二种情况;
dsser2:='';
mp:=0;
for i:=1 to lc do
begin
a1:=copy(Cser,i,1);
s:='7';
if (a1='0') and (mp=0) then
s:='A';
if (a1='1') and (mp=1) then
s:='B';
if (a1='2') and (mp=2) then
s:='C';
if (a1='3') and (mp=0) then
s:='D';
if (a1='4') and (mp=1) then
s:='E';
if (a1='5') and (mp=2) then
s:='F';
if (a1='6') and (mp=0) then
s:='G';
if (a1='7') and (mp=1) then
s:='H';
if (a1='8') and (mp=2) then
s:='I';
if (a1='9') and (mp=0) then
s:='J';
if (a1='0') and (mp=1) then
s:='K';
if (a1='1') and (mp=2) then
s:='L';
if (a1='2') and (mp=0) then
s:='M';
if (a1='3') and (mp=1) then
s:='N';
if (a1='4') and (mp=2) then
s:='O';
if (a1='5') and (mp=0) then
s:='P';
if (a1='6') and (mp=1) then
s:='Q';
if (a1='7') and (mp=2) then
s:='R';
if (a1='8') and (mp=0) then
s:='S';
if (a1='9') and (mp=1) then
s:='T';
if (a1='0') and (mp=2) then
s:='U';
if (a1='1') and (mp=0) then
s:='V';
if (a1='2') and (mp=1) then
s:='W';
if (a1='3') and (mp=2) then
s:='X';
if (a1='4') and (mp=0) then
s:='Y';
if (a1='5') and (mp=1) then
s:='Z';
if (a1='6') and (mp=2) then
s:='3';
if (a1='7') and (mp=0) then
s:='4';
if (a1='8') and (mp=1) then
s:='5';
if (a1='9') and (mp=2) then
s:='6';
dsser2:=dsser2+s;
end;
//第三种情况;
dsser3:='';
mp:=2;
for i:=1 to lc do
begin
a1:=copy(Cser,i,1);
s:='7';
if (a1='0') and (mp=0) then
s:='A';
if (a1='1') and (mp=1) then
s:='B';
if (a1='2') and (mp=2) then
s:='C';
if (a1='3') and (mp=0) then
s:='D';
if (a1='4') and (mp=1) then
s:='E';
if (a1='5') and (mp=2) then
s:='F';
if (a1='6') and (mp=0) then
s:='G';
if (a1='7') and (mp=1) then
s:='H';
if (a1='8') and (mp=2) then
s:='I';
if (a1='9') and (mp=0) then
s:='J';
if (a1='0') and (mp=1) then
s:='K';
if (a1='1') and (mp=2) then
s:='L';
if (a1='2') and (mp=0) then
s:='M';
if (a1='3') and (mp=1) then
s:='N';
if (a1='4') and (mp=2) then
s:='O';
if (a1='5') and (mp=0) then
s:='P';
if (a1='6') and (mp=1) then
s:='Q';
if (a1='7') and (mp=2) then
s:='R';
if (a1='8') and (mp=0) then
s:='S';
if (a1='9') and (mp=1) then
s:='T';
if (a1='0') and (mp=2) then
s:='U';
if (a1='1') and (mp=0) then
s:='V';
if (a1='2') and (mp=1) then
s:='W';
if (a1='3') and (mp=2) then
s:='X';
if (a1='4') and (mp=0) then
s:='Y';
if (a1='5') and (mp=1) then
s:='Z';
if (a1='6') and (mp=2) then
s:='3';
if (a1='7') and (mp=0) then
s:='4';
if (a1='8') and (mp=1) then
s:='5';
if (a1='9') and (mp=2) then
s:='6';
dsser3:=dsser3+s;
end;
dsser:=dsser1;
if dm1.tbreg['serno']=dsser1 then
dsser:=dsser1;
if dm1.tbreg['serno']=dsser2 then
dsser:=dsser2;
if dm1.tbreg['serno']=dsser3 then
dsser:=dsser3;
dm1.tbreg.edit;
dm1.tbreg['serno']:=dsser;
dm1.tbreg.post;
LABEL7.Caption:=dsser;
end;
procedure Tfmreg.okbtClick(Sender: TObject);
VAR
MM:STRING;
i,lc:integer;
a,s:array [0..25] of string;
passd:string;
p2,p3,p4,p5,p6,p7:string;
begin
IF (TRIM(NOED.Text)='') OR (TRIM(USERCO.Text)='') then
begin
MessageBox(handle,Pchar('请完整填写注册信息'),'注册信息',0+48);
exit;
end;
lc:=length(LABEL7.Caption);
mm:='';
for i:=1 to lc do
begin
a:=copy(LABEL7.Caption,i,1);
s:='*';
if ((a='A') OR (A='K' )) OR (A='U') then
s:='0';
if ((a='B') OR (A='L')) OR (A='V') then
s:='1';
if ((a='C') OR (A='M' )) OR (A='W') then
s:='2';
if ((a='D') OR (A='N' )) OR (A='X') then
s:='3';
if ((a='E') OR (A='O' )) OR (A='Y') then
s:='4';
if ((a='F') OR (A='P' )) OR (A='Z') then
s:='5';
if ((a='G') OR (A='Q' )) OR (A='3') then
s:='6';
if ((a='H') OR (A='R' )) OR (A='4') then
s:='7';
if ((a='I') OR (A='S' )) OR (A='5') then
s:='8';
if ((a='J') OR (A='T' )) OR (A='6') then
s:='9';
mm:=mm+s;
end;
Randomize;
p2:=copy (mm,3,1);
p3:=inttostr(Random(9));
p4:=copy (mm,length(mm),1);
p5:=INTTOSTR(Random(9));
p6:=copy (mm,4,1);
p7:=copy (mm,2,1);
PASSD:='MYNX'+P2+P3+P4+P5+P6+P7;
if ((p2=copy(reged.Text,6,1)) and (p4=copy(reged.Text,8,1)))
and ((p6=copy(reged.Text,10,1)) and (p7=copy(reged.Text,11,1)))
then
begin
MessageBox(handle,Pchar('注册成功,欢迎使用文章管理系统'),'注册成功',0+48);
dm1.tbreg.Edit;
dm1.tbreg['company']:=userco.Text;
dm1.tbreg['serno']:=label7.caption;
dm1.tbreg['regno']:=reged.Text;
dm1.tbreg['pcno']:=noed.Text;
dm1.tbreg.post;
dm1.tbreg.close;
fmlogin.Show;
nnn:=true;
fmreg.close;
end
else
begin
MessageBox(handle,Pchar('注册失败,系统将自动退出'),'注册失败',0+48);
fmmain.Close;
end;
end;
procedure Tfmreg.cabtClick(Sender: TObject);
begin
fmmain.Close;
end;
procedure Tfmreg.Button1Click(Sender: TObject);
begin
if trim(noed.text)='' then
begin
MessageBox(handle,Pchar('必须填写机号'),'注册信息',0+48);
end;
dm1.qrinf
pen;
if dm1.qrinfo.RecordCount>100 then
begin
MessageBox(handle,Pchar('请注册本软件再使用'),'试用期已过',0+48);
fmmain.Close;
end;
dm1.qrinfo.close;
fmlogin.show;
nnn:=true;
dm1.tbreg.Open;
dm1.tbreg.Edit;
dm1.tbreg['company']:=userco.Text;
dm1.tbreg['serno']:=label7.caption;
dm1.tbreg['regno']:='none';
dm1.tbreg['pcno']:=noed.Text;
dm1.tbreg.post;
dm1.tbreg.close;
fmreg.close;
end;
procedure Tfmreg.usercoExit(Sender: TObject);
begin
IF TRIM(USERCO.Text)='' then
USERCO.SetFocus;
end;
procedure Tfmreg.noedExit(Sender: TObject);
begin
IF TRIM(NOED.Text)='' then
NOED.SetFocus;
end;
procedure Tfmreg.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
if nnn=false then
fmmain.Close;
end;
end.