untlog.pas

来自「资料室图书借阅管理系统」· PAS 代码 · 共 177 行

PAS
177
字号
unit untlog;

interface

uses
  Classes, SysUtils, IWAppForm, IWApplication, IWTypes, IWCompButton,
  IWCompLabel, IWVCLBaseControl, IWBaseControl, IWControl, IWCompEdit,
  Controls, Forms, IWVCLBaseContainer, IWContainer, IWRegion, DB, ADODB,
  IWBaseLayoutComponent, IWBaseContainerLayout, IWContainerLayout,
  IWTemplateProcessorHTML, IWBaseHTMLControl, IWHTMLControls;

type
  Tfrmlog = class(TIWAppForm)
    IWLabel1: TIWLabel;
    IWEdit1: TIWEdit;
    IWEdit2: TIWEdit;
    IWButton1: TIWButton;
    IWLabel2: TIWLabel;
    IWTemplateProcessorHTML1: TIWTemplateProcessorHTML;
    ADOTable1: TADOTable;
    ADOQuery1: TADOQuery;
    IWLink1: TIWLink;
    procedure IWButton1Click(Sender: TObject);
    procedure IWAppFormCreate(Sender: TObject);
    procedure IWEdit2Submit(Sender: TObject);
    procedure IWLink1Click(Sender: TObject);
 private
    procedure Move(AFormClass: TIWAppFormClass);

  end;

implementation

uses ServerController, tempuntmain,untguest,untreadifo, untreg,
  rsFileVersion,U_guestMain;


{$R *.dfm}
procedure Tfrmlog.Move(AFormClass: TIWAppFormClass);
begin
  // Release the current form
  TIWAppForm(WebApplication.ActiveForm).Release;
  // tiwappform(webapplication.ActiveForm).Release;
  // Create the next form
  AFormClass.Create(WebApplication).Show;
end;
procedure Tfrmlog.IWButton1Click(Sender: TObject);
var
  result1,result2:variant;
  tempstr0,tempstr:string;
begin
if (fileexec=false) and (fexpire=true) then
abort;
  tempstr0:=iwedit1.Text;
  tempstr:=trim(tempstr0);
if length(tempstr)=0 then
    begin
      webapplication.showmessage('请正确输入您的用户名');
    end
else
  begin
       adoquery1.Close;
       adoquery1.SQL.Clear;
       adoquery1.SQL.Add('select * from LoginUser where Logname = '+quotedstr(tempstr));
       adoquery1.Open;
       adoquery1.first;



              // result1:=adoquery1.fieldbyname('password').AsString;

          //===========给result2 赋值   --------------
        if  adoquery1.FieldByName('password').IsNull then
        begin
           webapplication.ShowMessage('对不起,请您正确输入正确密码!!');
           exit;
        end
        else
        begin

           result2:=adoquery1.fieldbyname('team').AsString;
           //globdept:=adoquery1.fieldbyname('Departname').AsString;
           result1:=adoquery1.fieldbyname('password').AsString;

        end;
          //===========给result2 赋值   --------------




   // result1:=AdoTable1.Lookup('Logname',tempstr,'password');
   // result2:=AdoTable1.Lookup('Logname',tempstr,'team');
    temppassword:=result1;
    templogname:=tempstr;
    if (result1=trim(iwedit2.Text)) and (result2='管理员') then
      begin

      // if result2='管理员' then
      style:=1 ;
          move(ttempfrmmain);
           end             // master
       else
    if ( result1=trim(iwedit2.Text)) and (result2<>'管理员') then
      begin
       style:=2;    // ordinarily
       move( TIWForm_guest);
      end
   else
       if (trim(iwedit2.Text)<>result1) and ( trim(iwedit2.Text)<>'') then
       begin

       webapplication.ShowMessage('请输入正确的用户名和密码');
       iwedit2.Text:='';
       iwedit1.Text:='';
       iwedit1.SetFocus;
       end
       else
       begin
           move( TIWForm_guest);
       end;
   end;
end;



procedure Tfrmlog.IWAppFormCreate(Sender: TObject);
var
myVer:TrsFileVersion;
begin

   // myVer:=Trsfileversion.Create ;
   // Label8.Caption:='';
   // labversion.Caption:='';
   // myVer.GetFileVersion(webapplication.ApplicationPath+'weblib2004.exe' ) ; // myVer.Version
   // Label8.Caption:=myVer.Version;
   // labversion.Caption:=' 内部版本号:'+inttostr(myVer.Build)+' ';
    //labversion.Caption:=' 内部版本号:5.0';
//---------提示注册

 if fileexec=false then
 begin
    webapplication.ShowMessage('您还没有注册,欢迎使用正版软件!!');
 end
 else
 begin
     iwlink1.Visible:=false;
 end;


//---------end  提示注册-------
   strglob:=webapplication.ApplicationPath + 'tsjy.mdb' ;
   globfile:= webapplication.ApplicationPath + 'global.txt' ;

adoquery1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source= '+ strglob +' ;Persist Security Info=False';
//adotable1.TableName := 'LoginUser';
//adotable1.Open ;
iwedit1.Text:='Guest';
iwedit1.SetFocus;
iwedit2.Text:='';

end;

procedure Tfrmlog.IWEdit2Submit(Sender: TObject);
begin
  iwbutton1.OnClick(self);
end;

procedure Tfrmlog.IWLink1Click(Sender: TObject);
begin
    move(Tfrmreg);
end;

initialization
  Tfrmlog.SetAsMainForm;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?