Develop and Download Open Source Software

Browse Subversion Repository

Contents of /Unit6.pas

Parent Directory Parent Directory | Revision Log Revision Log


Revision 11 - (show annotations) (download) (as text)
Fri Jul 22 23:40:03 2016 UTC (7 years, 8 months ago) by yamat0jp
File MIME type: text/x-pascal
File size: 2931 byte(s)
パスワードをハッシュ値に置き換えました
クッキーに対応
1 unit Unit6;
2
3 interface
4
5 uses
6 Classes, SysUtils, IWAppForm, IWApplication, IWColor, IWTypes, Vcl.Controls,
7 IWVCLBaseControl, IWBaseControl, IWBaseHTMLControl, IWControl, IWCompEdit,
8 IWVCLComponent, IWBaseLayoutComponent, IWBaseContainerLayout,
9 IWContainerLayout, IWTemplateProcessorHTML, IWCompButton, Vcl.Forms, Unit2,
10 IWCompGrids, IWCompCalendar, IWCompLabel, IWDBGrids;
11
12 type
13 TUserForm = class(TIWAppForm)
14 IWTemplateProcessorHTML1: TIWTemplateProcessorHTML;
15 IWEdit1: TIWEdit;
16 IWEdit2: TIWEdit;
17 IWEdit3: TIWEdit;
18 IWEdit4: TIWEdit;
19 IWEdit5: TIWEdit;
20 IWButton1: TIWButton;
21 IWEdit6: TIWEdit;
22 IWButton2: TIWButton;
23 IWFrame1: TIWFrame1;
24 procedure IWButton1Click(Sender: TObject);
25 procedure IWButton2Click(Sender: TObject);
26 public
27 private
28 function Check: Boolean;
29 end;
30
31 implementation
32
33 {$R *.dfm}
34
35 uses Unit3, Unit1, ServerController;
36
37 function TUserForm.Check: Boolean;
38 begin
39 result := false;
40 if IWEdit1.Text = '' then
41 begin
42 WebApplication.ShowMessage('�����O������������������');
43 Exit;
44 end;
45 if Length(IWEdit5.Text) < 5 then
46 begin
47 WebApplication.ShowMessage('�T�����������p�X���[�h���g�p������������');
48 Exit;
49 end;
50 if IWEdit5.Text <> IWEdit6.Text then
51 WebApplication.ShowMessage('�p�X���[�h���������v��������')
52 else if DM.FDTable1.Locate('EMAIL', IWEdit3.Text, []) = false then
53 begin
54 result := (IWEdit1.Text <> '') and (IWEdit2.Text <> '') and
55 (IWEdit3.Text <> '') and (IWEdit4.Text <> '');
56 if result = false then
57 WebApplication.ShowMessage('����������������������');
58 end
59 else if DM.FDTable1.FieldByName('EMAIL').AsString <> '' then
60 WebApplication.ShowMessage('e-mail�������o�^������������');
61 if result = false then
62 begin
63 IWEdit5.Text := '';
64 IWEdit6.Text := '';
65 end;
66 end;
67
68 procedure TUserForm.IWButton1Click(Sender: TObject);
69 begin
70 if Check = true then
71 begin
72 if UserSession.user_number = 0 then
73 begin
74 DM.FDTable1.Last;
75 UserSession.user_number := DM.FDTable1.FieldByName('NUMBER').AsInteger + 1;
76 DM.FDTable1.AppendRecord([IWEdit1.Text, IWEdit3.Text, IWEdit2.Text,
77 IWEdit4.Text, UserSession.hash(IWEdit5.Text), UserSession.user_number, Date]);
78 end
79 else
80 begin
81 DM.FDTable1.Edit;
82 with DM.FDTable1.Fields do
83 begin
84 Fields[0].AsString:=IWEdit1.Text;
85 Fields[1].AsString:=IWEdit3.Text;
86 Fields[2].AsString:=IWEdit2.Text;
87 Fields[3].AsString:=IWEdit4.Text;
88 Fields[4].AsString:=UserSession.hash(IWEdit5.Text);
89 end;
90 DM.FDTable1.Post;
91 end;
92 WebApplication.Response.Cookies.AddCookie('user_cookie',UserSession.user_number.ToString,'/',Date+10);
93 Release;
94 IWForm1.Page := false;
95 end;
96 end;
97
98 procedure TUserForm.IWButton2Click(Sender: TObject);
99 begin
100 Release;
101 end;
102
103 end.

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