L
lion_fenn
Unregistered / Unconfirmed
GUEST, unregistred user!
附上原码:
unit getinUnit;
interface
uses
Windows, Messages, SysUtils, Classes, HTTPApp, WebModu, HTTPProd,
WebComp, WebAdapt, CompProd, PagItems, SiteProd, MidItems, WebForm;
type
Tgetin = class(TWebPageModule)
AdapterPageProducer: TAdapterPageProducer;
Adapter1: TAdapter;
f_msisdn: TAdapterField;
f_password: TAdapterField;
a_get: TAdapterAction;
AdapterForm1: TAdapterForm;
AdapterFieldGroup1: TAdapterFieldGroup;
AdapterEditColumn: TAdapterEditColumn;
AdapterEditColumn2: TAdapterEditColumn;
AdapterCommandGroup1: TAdapterCommandGroup;
dl: TAdapterActionButton;
procedure f_msisdnGetValue(Sender: TObject; var Value: Variant);
procedure f_passwordGetValue(Sender: TObject; var Value: Variant);
procedure Adapter1BeforeExecuteAction(Sender, Action: TObject;
Params: TStrings; var Handled: Boolean);
procedure a_getExecute(Sender: TObject; Params: TStrings);
private
{ Private declarations }
public
{ Public declarations }
m_msisdn,m_password,temp_passwd,m_cusid:string;
end;
function getin: Tgetin;
implementation
{$R *.dfm} {*.html}
uses WebReq, WebCntxt, WebFact, Variants, dmUnit;
function getin: Tgetin;
begin
Result := Tgetin(WebContext.FindModuleClass(Tgetin));
end;
procedure Tgetin.f_msisdnGetValue(Sender: TObject; var Value: Variant);
begin
Value:=m_msisdn;
end;
procedure Tgetin.f_passwordGetValue(Sender: TObject; var Value: Variant);
begin
Value:=m_password;
end;
procedure Tgetin.Adapter1BeforeExecuteAction(Sender, Action: TObject;
Params: TStrings; var Handled: Boolean);
begin
if Assigned(f_msisdn.ActionValue) then
m_msisdn:=f_msisdn.ActionValue.Values[0];
if Assigned(f_password.ActionValue) then
m_password:=f_password.ActionValue.Values[0];
end;
procedure Tgetin.a_getExecute(Sender: TObject; Params: TStrings);
var
source,dest,schar;
i,len,cnt,li_loop,nn,n1,n2,n3,n4:Integer;
cc,c1,c2,c3,c4:char;
begin
dm.Query1.Active:=false;
dm.Query1.SQL.Clear;
dm.Query1.SQL.Add('select passwd from bsn_customer,bsn_user_gsm where');
dm.Query1.SQL.Add('bsn_customer.cusid=bsn_user_gsm.cusid and');
dm.Query1.SQL.Add('bsn_user_gsm.msisdn=');
dm.Query1.SQL.Add(m_msisdn);
dm.Query1.Active:=true;
temp_passwd:=dm.Query1.FieldByName('passwd').Value;
Getmem(source,sizeof(char)*40);
Getmem(dest,sizeof(char)*40);
Getmem(s,sizeof(char)*40);
strCopy(source,@temp_passwd);
len:=strlen(source);
cnt:=len div 4;
for li_loop:=0 to cnt-1 do
begin
strcopy(s,source);
cc:=chr($00);
c1:=chr($00);
c2:=chr($00);
i:=3;
while (i<>0) do
begin
n2:=ord(c2) shl 2;
c2:=chr(n2);
cc:=s[li_loop*4+i];
nn:=ord(cc);
n4:=nn and $41;
case n4 of
65:n1:=0;
1:n1:=1;
64:n1:=$02;
0:n1:=$03;
end;
n2:=n1 or n2;
i:=i-1;
end;
n3:=not n2;
c3:=chr(n3);
dest[li_loop]:=c3;
dest[li_loop+1]:=chr($00);
end;
if m_password=dest^ then
dl.PageName:='querypage'
else
dl.PageName:='wrongpage';
end;
initialization
if WebRequestHandler <> nil then
WebRequestHandler.AddWebModuleFactory(TWebPageModuleFactory.Create(Tgetin, TWebPageInfo.Create([wpPublished {, wpLoginRequired}], '.html'), crOnDemand, caCache));
end.
unit getinUnit;
interface
uses
Windows, Messages, SysUtils, Classes, HTTPApp, WebModu, HTTPProd,
WebComp, WebAdapt, CompProd, PagItems, SiteProd, MidItems, WebForm;
type
Tgetin = class(TWebPageModule)
AdapterPageProducer: TAdapterPageProducer;
Adapter1: TAdapter;
f_msisdn: TAdapterField;
f_password: TAdapterField;
a_get: TAdapterAction;
AdapterForm1: TAdapterForm;
AdapterFieldGroup1: TAdapterFieldGroup;
AdapterEditColumn: TAdapterEditColumn;
AdapterEditColumn2: TAdapterEditColumn;
AdapterCommandGroup1: TAdapterCommandGroup;
dl: TAdapterActionButton;
procedure f_msisdnGetValue(Sender: TObject; var Value: Variant);
procedure f_passwordGetValue(Sender: TObject; var Value: Variant);
procedure Adapter1BeforeExecuteAction(Sender, Action: TObject;
Params: TStrings; var Handled: Boolean);
procedure a_getExecute(Sender: TObject; Params: TStrings);
private
{ Private declarations }
public
{ Public declarations }
m_msisdn,m_password,temp_passwd,m_cusid:string;
end;
function getin: Tgetin;
implementation
{$R *.dfm} {*.html}
uses WebReq, WebCntxt, WebFact, Variants, dmUnit;
function getin: Tgetin;
begin
Result := Tgetin(WebContext.FindModuleClass(Tgetin));
end;
procedure Tgetin.f_msisdnGetValue(Sender: TObject; var Value: Variant);
begin
Value:=m_msisdn;
end;
procedure Tgetin.f_passwordGetValue(Sender: TObject; var Value: Variant);
begin
Value:=m_password;
end;
procedure Tgetin.Adapter1BeforeExecuteAction(Sender, Action: TObject;
Params: TStrings; var Handled: Boolean);
begin
if Assigned(f_msisdn.ActionValue) then
m_msisdn:=f_msisdn.ActionValue.Values[0];
if Assigned(f_password.ActionValue) then
m_password:=f_password.ActionValue.Values[0];
end;
procedure Tgetin.a_getExecute(Sender: TObject; Params: TStrings);
var
source,dest,schar;
i,len,cnt,li_loop,nn,n1,n2,n3,n4:Integer;
cc,c1,c2,c3,c4:char;
begin
dm.Query1.Active:=false;
dm.Query1.SQL.Clear;
dm.Query1.SQL.Add('select passwd from bsn_customer,bsn_user_gsm where');
dm.Query1.SQL.Add('bsn_customer.cusid=bsn_user_gsm.cusid and');
dm.Query1.SQL.Add('bsn_user_gsm.msisdn=');
dm.Query1.SQL.Add(m_msisdn);
dm.Query1.Active:=true;
temp_passwd:=dm.Query1.FieldByName('passwd').Value;
Getmem(source,sizeof(char)*40);
Getmem(dest,sizeof(char)*40);
Getmem(s,sizeof(char)*40);
strCopy(source,@temp_passwd);
len:=strlen(source);
cnt:=len div 4;
for li_loop:=0 to cnt-1 do
begin
strcopy(s,source);
cc:=chr($00);
c1:=chr($00);
c2:=chr($00);
i:=3;
while (i<>0) do
begin
n2:=ord(c2) shl 2;
c2:=chr(n2);
cc:=s[li_loop*4+i];
nn:=ord(cc);
n4:=nn and $41;
case n4 of
65:n1:=0;
1:n1:=1;
64:n1:=$02;
0:n1:=$03;
end;
n2:=n1 or n2;
i:=i-1;
end;
n3:=not n2;
c3:=chr(n3);
dest[li_loop]:=c3;
dest[li_loop+1]:=chr($00);
end;
if m_password=dest^ then
dl.PageName:='querypage'
else
dl.PageName:='wrongpage';
end;
initialization
if WebRequestHandler <> nil then
WebRequestHandler.AddWebModuleFactory(TWebPageModuleFactory.Create(Tgetin, TWebPageInfo.Create([wpPublished {, wpLoginRequired}], '.html'), crOnDemand, caCache));
end.