Develop and Download Open Source Software

Browse Subversion Repository

Diff of /UserSessionUnit.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 8 by yamat0jp, Thu Dec 31 08:51:02 2015 UTC revision 11 by yamat0jp, Fri Jul 22 23:40:03 2016 UTC
# Line 1  Line 1 
1  unit UserSessionUnit;  unit UserSessionUnit;
2    
3  {  {
4    This is a DataModule where you can add components or declare fields that are specific to    This is a DataModule where you can add components or declare fields that are specific to
5    ONE user. Instead of creating global variables, it is better to use this datamodule. You can then    ONE user. Instead of creating global variables, it is better to use this datamodule. You can then
6    access the it using UserSession.    access the it using UserSession.
7  }  }
# Line 24  type Line 24  type
24      user_number: integer;      user_number: integer;
25      FThumbnail: Boolean;      FThumbnail: Boolean;
26      Serial: integer;      Serial: integer;
27        function hash(const pass: string): string;
28      property DM: TDataModule3 read GetDM;      property DM: TDataModule3 read GetDM;
29    end;    end;
30    
31  implementation  implementation
32    
33  {$R *.dfm}  {$R *.dfm}
   
34  { TIWUserSession }  { TIWUserSession }
35    
36  function TIWUserSession.GetDM: TDataModule3;  function TIWUserSession.GetDM: TDataModule3;
37  begin  begin
38    if Assigned(FDM) = false then    if Assigned(FDM) = false then
39      FDM:=TDataModule3.Create(nil);      FDM := TDataModule3.Create(nil);
40    result:=FDM;    result := FDM;
41    end;
42    
43    function TIWUserSession.hash(const pass: string): string;
44    var
45      i: integer;
46      k: integer;
47    begin
48      result := '';
49      for i := Length(pass) downto 1 do
50      begin
51        k := Ord(pass[i]) * i;
52        result := result + k.ToString;
53      end;
54  end;  end;
55    
56  procedure TIWUserSession.IWUserSessionBaseCreate(Sender: TObject);  procedure TIWUserSession.IWUserSessionBaseCreate(Sender: TObject);
57    var
58      s: string;
59  begin  begin
60    FPage := true;    FThumbnail := true;
61    FThumbnail:=true;    s := WebApplication.Request.CookieFields.Values['user_cookie'];
62      if (s <> '') and (DM.FDTable1.Locate('NUMBER', s, []) = true) then
63      begin
64        user_number:=s.ToInteger;
65        if DM.FDTable1.FieldByName('EMAIL').AsString = '' then
66          FPage:=true
67        else
68          FPage:=false;
69      end
70      else
71        FPage:=true;
72  end;  end;
73    
74  procedure TIWUserSession.IWUserSessionBaseDestroy(Sender: TObject);  procedure TIWUserSession.IWUserSessionBaseDestroy(Sender: TObject);
# Line 52  begin Line 77  begin
77  end;  end;
78    
79  end.  end.
   
   

Legend:
Removed from v.8  
changed lines
  Added in v.11

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26