Changeset 98
- Timestamp:
- Oct 2, 2012, 12:24:00 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/User/UUserControlPage.pas
r91 r98 93 93 Form.Load(HandlerData.Request.Post); 94 94 with THtmlString(SubItems.AddNew(THtmlString.Create)) do 95 Text := 'Přihlášení u ser: ' + TQueryFormGroup(Form.Groups[0]).Rows.FindByName('UserName').Value.Value;95 Text := 'Přihlášení uživatele: ' + TQueryFormGroup(Form.Groups[0]).Rows.FindByName('UserName').Value.Value; 96 96 UserId := User.GetIdByNamePassword(TQueryFormGroup(Form.Groups[0]).Rows.FindByName('UserName').Value.Value, 97 97 TQueryFormGroup(Form.Groups[0]).Rows.FindByName('Password').Value.Value); 98 UserOnline.Login(UserId); 98 if UserId = -1 then begin 99 with THtmlString(SubItems.AddNew(THtmlString.Create)) do 100 Text := '<br/>Chybné jméno nebo heslo'; 101 end else UserOnline.Login(UserId); 99 102 Form.Free; 100 103 end else … … 157 160 UserId := User.GetIdByNamePassword(TQueryFormGroup(Form.Groups[0]).Rows.FindByName('UserName').Value.Value, 158 161 TQueryFormGroup(Form.Groups[0]).Rows.FindByName('Password').Value.Value); 159 UserOnline.Login(UserId);162 if UserId <> -1 then UserOnline.Login(UserId); 160 163 Form.Free; 161 164 end else SubItems.AddNew(Form); … … 188 191 Hint := 'Zadejte vaše přihlašovací jméno'; 189 192 Required := True; 193 Value.Value := User.Name; 190 194 end; 191 195 with AddNewItem do begin … … 202 206 Required := True; 203 207 ItemType := fitText; 208 Value.Value := User.Email; 204 209 end; 205 210 with AddNewItem do begin … … 209 214 Required := False; 210 215 ItemType := fitText; 216 Value.Value := User.FullName; 211 217 end; 212 218 end; … … 221 227 with THtmlString(SubItems.AddNew(THtmlString.Create)) do 222 228 Text := 'Profil uživatele: ' + TQueryFormGroup(Form.Groups[0]).Rows.FindByName('UserName').Value.Value + ' uložen'; 229 User.Name := TQueryFormGroup(Form.Groups[0]).Rows.FindByName('UserName').Value.Value; 230 User.FullName := TQueryFormGroup(Form.Groups[0]).Rows.FindByName('FullName').Value.Value; 231 User.Email := TQueryFormGroup(Form.Groups[0]).Rows.FindByName('Email').Value.Value; 232 User.Save; 223 233 Form.Free; 224 234 end else SubItems.AddNew(Form); -
trunk/Modules/ZdechovNET/UHostingPage.pas
r97 r98 61 61 'Použité technologie: <a href="http://www.linux.cz/">GNU/Linux</a>, <a href="http://openvz.org/">OpenVZ</a>, <a href="http://pve.proxmox.com/">Proxmox VE</a>, <a href="http://backuppc.sourceforge.net/">BackupPC</a><br/>' + 62 62 '<br/>' + 63 '<i>Aktualizováno: 3.4.2010</i><br/><br/>';63 '<i>Aktualizováno: 1.10.2012</i><br/><br/>'; 64 64 65 65 Text := Text + '<p>Hosting je využíván především pro provoz herních serverů MMORPG her jako např. World of Warcraft (WoW), Lineage II, Aion, aj.</p>'; -
trunk/Modules/ZdechovNET/UModuleZdechovNET.pas
r97 r98 146 146 ') ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;'); 147 147 148 Core.CommonDatabase.Query(DbRows, 149 'CREATE TABLE IF NOT EXISTS `HostedProject` (' + 150 ' `Id` int(11) NOT NULL AUTO_INCREMENT,' + 151 ' `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,' + 152 ' `Homepage` varchar(255) COLLATE utf8_czech_ci NOT NULL,' + 153 ' `User` int(255) NOT NULL COMMENT "User.Id",' + 154 ' `TimeCreate` datetime NOT NULL,' + 155 ' `Server` int(11) DEFAULT NULL COMMENT "NetworkDevice.Id",' + 156 ' `Active` int(11) NOT NULL DEFAULT "1",' + 157 ' `WebHosting` int(11) NOT NULL,' + 158 ' PRIMARY KEY (`Id`)' + 159 ') ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;'); 160 148 161 finally 149 162 Data.Free; … … 161 174 try 162 175 DbRows := TDbRows.Create; 176 Core.CommonDatabase.Query(DbRows, 'DROP TABLE IF EXISTS `HostedProject`'); 163 177 Core.CommonDatabase.Query(DbRows, 'DROP TABLE IF EXISTS `Plans`'); 164 178 Core.CommonDatabase.Query(DbRows, 'DROP TABLE IF EXISTS `Webcam`'); -
trunk/Packages/CoolWeb/Modules/UUser.pas
r97 r98 6 6 7 7 uses 8 Classes, SysUtils, synacode, USqlDatabase, UCommon, UHTTPServer; 8 Classes, SysUtils, synacode, USqlDatabase, UCommon, UHTTPServer, 9 SpecializedDictionary; 9 10 10 11 const … … 24 25 Database: TSqlDatabase; 25 26 HandlerData: THTTPHandlerData; 27 procedure Save; 26 28 procedure Delete(Id: Integer); 27 29 procedure Add(Name, Password, Email: string); … … 112 114 { TUser } 113 115 116 procedure TWebUser.Save; 117 var 118 DbRows: TDbRows; 119 Data: TDictionaryStringString; 120 begin 121 try 122 DbRows := TDbRows.Create; 123 Data := TDictionaryStringString.Create; 124 Data.Add('FullName', FullName); 125 Data.Add('Email', Email); 126 Data.Add('Name', Name); 127 //Data.Add('Password', 'SHA1(CONCAT("' + Password + '", "' + Salt + '"))'); 128 Database.Update('User', Data, '`Id`=' + IntToStr(Id)); 129 finally 130 Data.Free; 131 DbRows.Free; 132 end; 133 end; 134 114 135 procedure TWebUser.Delete(Id: Integer); 115 136 var … … 129 150 DbRows: TDbRows; 130 151 begin 131 if (Name = '') or (Password = '') or (Email = '') then raise Exception.Create(SEmptyUserParameters); 152 if (Name = '') or (Password = '') or (Email = '') then 153 raise Exception.Create(SEmptyUserParameters); 132 154 try 133 155 DbRows := TDbRows.Create; … … 135 157 if DbRows.Count = 0 then begin 136 158 Salt := EncodeBase64(Copy(BinToHexString(SHA1(FloatToStr(Now))), 1, 8)); 137 Database.Query(DbRows, 'INSERT INTO `User` (`Name`, `Password`, `Salt`, `Email`, `RegistrationTime` ) VALUES ("' +159 Database.Query(DbRows, 'INSERT INTO `User` (`Name`, `Password`, `Salt`, `Email`, `RegistrationTime`, `FullName`) VALUES ("' + 138 160 Name + '", SHA1(CONCAT("' + Password + '", "' + Salt + '")), "' + Salt + 139 '", "' + Email + '", NOW() )');161 '", "' + Email + '", NOW(), "")'); 140 162 end else raise EDuplicateItem.Create(Format(SDuplicateUserItem, [Name])); 141 163 finally … … 152 174 Database.Query(DbRows, 'SELECT `Id` FROM `User` WHERE `Name`="' + Name + '"'); 153 175 if DbRows.Count = 1 then Result := StrToInt(DbRows[0].Items[0].Value) 154 else raise ENotFound.Create(Format(SUserNotFound, [Name]));176 else Result := -1; 155 177 finally 156 178 DBRows.Free; … … 167 189 '`Password` = SHA1(CONCAT("' + Password + '", Salt))'); 168 190 if DbRows.Count = 1 then Result := StrToInt(DbRows[0].Items[0].Value) 169 else raise ENotFound.Create(Format(SUserNotFound, [Name]));191 else Result := -1; 170 192 finally 171 193 DBRows.Free; … … 184 206 FullName := DbRows[0].Values['FullName']; 185 207 Email := DbRows[0].Values['Email']; 186 end else raise ENotFound.Create(Format(SUserNotFound, [IntToStr(Id)]));208 end; // else raise ENotFound.Create(Format(SUserNotFound, [IntToStr(Id)])); 187 209 finally 188 210 DBRows.Free; -
trunk/Packages/CoolWeb/WebServer/UHTTPServerTCP.pas
r96 r98 42 42 HandlerData: THTTPHandlerData; 43 43 I: Integer; 44 ContentLength: Integer; 44 45 begin 45 46 with TTCPClientThread(Sender), Socket do begin … … 81 82 Inc(LineIndex); 82 83 until Line = ''; 84 85 if Request.Method = 'POST' then begin 86 ContentLength := StrToInt(Request.Headers.Values['Content-Length']); 87 SetLength(Line, ContentLength); 88 RecvBufferEx(PByte(Line), ContentLength, 1000); 89 Request.Post.Parse(Line); 90 end; 83 91 finally 84 92 LineParts.Free; 85 93 end; 94 95 86 96 87 97 // Process cookies … … 95 105 Response.Content.Clear; 96 106 Response.Headers.Add('Content-Type', 'text/html'); 107 108 97 109 98 110 if Assigned(OnRequest) then OnRequest(HandlerData) -
trunk/UCore.pas
r94 r98 88 88 UModuleSystem, UModuleZdechovNET, UModuleUser, UPageAdmin; 89 89 90 resourcestring 91 SError = '<div>Error: %s</div>'; 92 90 93 { TWebSession } 91 94 … … 366 369 NewSession.Database.UserName := DatabaseUserName; 367 370 NewSession.InitDatabase; 368 Page.Page.OnProduce(NewSession); 371 try 372 Page.Page.OnProduce(NewSession); 373 except 374 on E: Exception do begin 375 THTMLString(TWebSession(NewSession).HtmlDocument.Body.SubItems.AddNew(THtmlString.Create)). 376 Text := Format(SError, [E.Message]); 377 NewSession.GeneratePage(Page.Page); 378 end; 379 end; 369 380 HandlerData.Assign(NewSession); 370 381 end else begin -
trunk/languages/index.cs.po
r76 r98 58 58 msgstr "" 59 59 60 #: ucore.serror 61 msgid "<div>Error: %s</div>" 62 msgstr "" 63 60 64 #: ucustomapplication.spagenotfound 61 65 msgctxt "ucustomapplication.spagenotfound" -
trunk/languages/index.po
r76 r98 50 50 msgstr "" 51 51 52 #: ucore.serror 53 msgid "<div>Error: %s</div>" 54 msgstr "" 55 52 56 #: ucustomapplication.spagenotfound 53 57 msgctxt "ucustomapplication.spagenotfound"
Note:
See TracChangeset
for help on using the changeset viewer.