Changeset 36
- Timestamp:
- Oct 29, 2010, 10:44:13 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/UCustomApplication.pas
r35 r36 8 8 Classes, SysUtils, UHTTPServerCGI, Contnrs, USqlDatabase, UConfig, DateUtils, 9 9 UXmlClasses, UHtmlClasses, UCore, UStringListEx, UHTTPServer, UHTTPServerTCP, 10 UHTTPSessionMySQL, UHTTPSessionFile ;10 UHTTPSessionMySQL, UHTTPSessionFile, UUser; 11 11 12 12 type … … 46 46 ModuleName: string; 47 47 BaseURL: string; 48 User: TWebUser; 49 UserOnline: TWebOnlineUser; 48 50 procedure Run; 49 51 procedure Execute(HandlerData: THTTPHandlerData); … … 95 97 TitleTag: THtmlString; 96 98 begin 99 User.HandlerData := HandlerData; 100 UserOnline.HandlerData := HandlerData; 101 UserOnline.Update; 97 102 with HandlerData do begin 98 103 Style := ConfigStyle; … … 133 138 Pages := TObjectList.Create; 134 139 HtmlDocument := THtmlDocument.Create; 140 User := TWebUser.Create; 141 User.Database := Database; 142 UserOnline := TWebOnlineUser.Create; 143 UserOnline.Database := Database; 135 144 end; 136 145 … … 141 150 Pages.Free; 142 151 HTTPServer.Free; 152 User.Free; 153 UserOnline.Free; 143 154 inherited Destroy; 144 155 end; … … 230 241 '<li><a href="https://mail.zdechov.net/">Pošta</a></li>' + 231 242 '<li><a href="http://wiki.zdechov.net/">Wiki</a></li>' + 232 '</ul><ul class="MenuItem2"> <li> </li>';233 (* if System.UserOnline.User = System.UserOnline.AnonymousUserId then begin243 '</ul><ul class="MenuItem2">'; //<li> </li>'; 244 if UserOnline.User = AnonymousUserId then begin 234 245 Text := Text + '</ul>' + 235 246 '<ul class="MenuItem2">' + 236 '<li>' + MakeLink('Přihlášení', Navigation MakeLink('User', 'Login')) + '</li>';247 '<li>' + MakeLink('Přihlášení', NavigationLink('/uzivatel/prihlaseni/')) + '</li>'; 237 248 //$Output .= '<li>'.$this->System->HTML->MakeLink($this->System->Translate('UserRegistration'), $this->System->MakeLink('UserList', 'Register')).'</li>'; 238 249 end else begin 239 250 Text := Text + '</ul>' + 240 251 '<ul class="MenuItem2">' + 241 '<li>' + System.User.FullName + '</li>' + 242 '<li>' + MakeLink('Odhlášení', NavigationMakeLink('User', 'Logout')) + '</li>' + 243 '<li>' + MakeLink('Profil', NavigationMakeLink('User', 'View', 244 array('Id' => $this->System->User->Id))).'</li>'; 245 end; 246 *) 252 '<li>' + User.FullName + '</li>' + 253 '<li>' + MakeLink('Odhlášení', NavigationLink('/uzivatel/odhlaseni/')) + '</li>' + 254 '<li>' + MakeLink('Profil', NavigationLink('/uzivatel/profil/')) + '</li>'; 255 end; 247 256 Text := Text + '</ul></div>'; 248 257 end; -
trunk/Application/UUser.pas
r33 r36 8 8 Classes, SysUtils, synacode, USqlDatabase, UCommon, UHTTPServer; 9 9 10 const 11 AnonymousUserId = 1; 12 10 13 type 11 14 EDuplicateItem = class(Exception); … … 15 18 16 19 TWebUser = class 20 FullName: string; 17 21 Database: TSqlDatabase; 18 22 HandlerData: THTTPHandlerData; … … 47 51 Id: Integer; 48 52 begin 49 DbRows := Database.Query('SELECT * FROM `UserOnline` WHERE `SessionId`="' + 50 HandlerData.Request.Cookies.Values['SessionId'] + '"'); 51 if DbRows.Count > 0 then begin 52 // Update exited 53 Id := StrToInt(DbRows[0].Values['Id']); 53 try 54 DbRows := Database.Query('SELECT * FROM `UserOnline` WHERE `SessionId`="' + 55 HandlerData.Request.Cookies.Values['SessionId'] + '"'); 56 if DbRows.Count > 0 then begin 57 // Update exited 58 Id := StrToInt(DbRows[0].Values['Id']); 59 User := StrToInt(DbRows[0].Values['User']); 60 DbRows.Free; 61 DbRows := Database.Query('UPDATE `UserOnline` SET `ActivityTime` = NOW() WHERE `Id`=' + IntToStr(Id)); 62 end else begin 63 // Create new record 64 DbRows.Free; 65 DbRows := Database.Query('INSERT INTO `UserOnline` (`User`, `ActivityTime`, `SessionId`) ' + 66 'VALUES (1, NOW(), "' + HandlerData.Request.Cookies.Values['SessionId'] + '")'); 67 Id := Database.LastInsertId; 68 User := 1; 69 end; 70 finally 54 71 DbRows.Free; 55 DbRows := Database.Query('UPDATE `UserOnline` SET `ActivityTime` = NOW() WHERE `Id`=' + IntToStr(Id));56 end else begin57 // Create new record58 DbRows.Free;59 DbRows := Database.Query('INSERT INTO `UserOnline` (`User`, `ActivityTime`, `SessionId`) ' +60 'VALUES (1, NOW(), "' + HandlerData.Request.Cookies.Values['SessionId'] + '")');61 Id := Database.LastInsertId;62 72 end; 63 DbRows.Destroy;64 73 end; 65 74 … … 69 78 begin 70 79 Logout; 71 DbRows := Database.Query('UPDATE `UserOnline` SET `User` = ' + IntToStr(User) + ', `LoginTime` = NOW() WHERE `SessionId`="' + 72 HandlerData.Request.Cookies.Values['SessionId'] + '"'); 73 DbRows.Destroy; 80 try 81 DbRows := Database.Query('UPDATE `UserOnline` SET `User` = ' + IntToStr(User) + ', `LoginTime` = NOW() WHERE `SessionId`="' + 82 HandlerData.Request.Cookies.Values['SessionId'] + '"'); 83 finally 84 DbRows.Free; 85 end; 74 86 Self.User := User; 75 87 end; … … 79 91 DbRows: TDbRows; 80 92 begin 81 if Id = 1then Update;82 if User <> 1then begin83 DbRows := Database.Query('UPDATE `UserOnline` SET `User` = 1WHERE `SessionId`="' +93 if Id = AnonymousUserId then Update; 94 if User <> AnonymousUserId then begin 95 DbRows := Database.Query('UPDATE `UserOnline` SET `User` = ' + IntToStr(AnonymousUserId) + ' WHERE `SessionId`="' + 84 96 HandlerData.Request.Cookies.Values['SessionId'] + '"'); 85 97 DbRows.Destroy; 86 User := 1;98 User := AnonymousUserId; 87 99 end; 88 100 end; -
trunk/CGI.lpi
r34 r36 21 21 <StringTable ProductVersion=""/> 22 22 </VersionInfo> 23 <BuildModes Count="1"> 24 <Item1 Name="default" Default="True"/> 25 </BuildModes> 23 26 <PublishOptions> 24 27 <Version Value="2"/> … … 39 42 </Item1> 40 43 </RequiredPackages> 41 <Units Count="6 7">44 <Units Count="68"> 42 45 <Unit0> 43 46 <Filename Value="CGI.lpr"/> … … 46 49 <EditorIndex Value="0"/> 47 50 <WindowIndex Value="0"/> 48 <TopLine Value=" 3"/>49 <CursorPos X=" 29" Y="25"/>50 <UsageCount Value=" 187"/>51 <TopLine Value="1"/> 52 <CursorPos X="30" Y="27"/> 53 <UsageCount Value="203"/> 51 54 <Loaded Value="True"/> 52 55 <LoadedDesigner Value="True"/> … … 59 62 <EditorIndex Value="24"/> 60 63 <WindowIndex Value="0"/> 61 <TopLine Value=" 259"/>62 <CursorPos X=" 47" Y="281"/>63 <UsageCount Value="1 83"/>64 <TopLine Value="313"/> 65 <CursorPos X="20" Y="316"/> 66 <UsageCount Value="199"/> 64 67 <Loaded Value="True"/> 65 68 <DefaultSyntaxHighlighter Value="Delphi"/> … … 71 74 <TopLine Value="291"/> 72 75 <CursorPos X="1" Y="311"/> 73 <UsageCount Value="14 2"/>76 <UsageCount Value="140"/> 74 77 <DefaultSyntaxHighlighter Value="Delphi"/> 75 78 </Unit2> 76 79 <Unit3> 77 80 <Filename Value="UXmlClasses.pas"/> 78 <UsageCount Value="14 2"/>81 <UsageCount Value="140"/> 79 82 <DefaultSyntaxHighlighter Value="Delphi"/> 80 83 </Unit3> … … 83 86 <IsPartOfProject Value="True"/> 84 87 <UnitName Value="UCore"/> 85 <EditorIndex Value="3 3"/>88 <EditorIndex Value="34"/> 86 89 <WindowIndex Value="0"/> 87 90 <TopLine Value="37"/> 88 91 <CursorPos X="69" Y="51"/> 89 <UsageCount Value=" 187"/>92 <UsageCount Value="203"/> 90 93 <Loaded Value="True"/> 91 94 <DefaultSyntaxHighlighter Value="Delphi"/> … … 97 100 <TopLine Value="217"/> 98 101 <CursorPos X="5" Y="236"/> 99 <UsageCount Value="14 2"/>102 <UsageCount Value="140"/> 100 103 <DefaultSyntaxHighlighter Value="Delphi"/> 101 104 </Unit5> … … 106 109 <TopLine Value="10"/> 107 110 <CursorPos X="27" Y="19"/> 108 <UsageCount Value="14 2"/>111 <UsageCount Value="140"/> 109 112 <DefaultSyntaxHighlighter Value="Delphi"/> 110 113 </Unit6> … … 114 117 <TopLine Value="17"/> 115 118 <CursorPos X="34" Y="30"/> 116 <UsageCount Value="14 2"/>119 <UsageCount Value="140"/> 117 120 <DefaultSyntaxHighlighter Value="Delphi"/> 118 121 </Unit7> … … 123 126 <TopLine Value="204"/> 124 127 <CursorPos X="25" Y="226"/> 125 <UsageCount Value="14 2"/>128 <UsageCount Value="140"/> 126 129 <DefaultSyntaxHighlighter Value="Delphi"/> 127 130 </Unit8> … … 132 135 <TopLine Value="102"/> 133 136 <CursorPos X="25" Y="107"/> 134 <UsageCount Value="14 2"/>137 <UsageCount Value="140"/> 135 138 <DefaultSyntaxHighlighter Value="Delphi"/> 136 139 </Unit9> … … 140 143 <TopLine Value="2320"/> 141 144 <CursorPos X="30" Y="2342"/> 142 <UsageCount Value=" 11"/>145 <UsageCount Value="9"/> 143 146 <DefaultSyntaxHighlighter Value="Delphi"/> 144 147 </Unit10> … … 149 152 <TopLine Value="40"/> 150 153 <CursorPos X="9" Y="59"/> 151 <UsageCount Value="1 30"/>154 <UsageCount Value="128"/> 152 155 <DefaultSyntaxHighlighter Value="Delphi"/> 153 156 </Unit11> 154 157 <Unit12> 155 158 <Filename Value="/usr/share/fpcsrc/rtl/objpas/sysutils/datih.inc"/> 156 <EditorIndex Value="3 1"/>159 <EditorIndex Value="32"/> 157 160 <WindowIndex Value="0"/> 158 161 <TopLine Value="91"/> 159 162 <CursorPos X="10" Y="110"/> 160 <UsageCount Value="3 0"/>163 <UsageCount Value="38"/> 161 164 <Loaded Value="True"/> 162 165 <DefaultSyntaxHighlighter Value="Delphi"/> … … 164 167 <Unit13> 165 168 <Filename Value="/usr/share/fpcsrc/rtl/objpas/dateutil.inc"/> 166 <EditorIndex Value="2 6"/>169 <EditorIndex Value="27"/> 167 170 <WindowIndex Value="0"/> 168 171 <TopLine Value="283"/> 169 172 <CursorPos X="10" Y="302"/> 170 <UsageCount Value=" 23"/>173 <UsageCount Value="31"/> 171 174 <Loaded Value="True"/> 172 175 <DefaultSyntaxHighlighter Value="Delphi"/> … … 180 183 <TopLine Value="1"/> 181 184 <CursorPos X="92" Y="11"/> 182 <UsageCount Value="1 62"/>185 <UsageCount Value="178"/> 183 186 <Loaded Value="True"/> 184 187 <DefaultSyntaxHighlighter Value="Delphi"/> … … 189 192 <TopLine Value="108"/> 190 193 <CursorPos X="1" Y="134"/> 191 <UsageCount Value="1 62"/>194 <UsageCount Value="178"/> 192 195 <DefaultSyntaxHighlighter Value="None"/> 193 196 </Unit15> … … 197 200 <TopLine Value="1"/> 198 201 <CursorPos X="1" Y="1"/> 199 <UsageCount Value="1 62"/>202 <UsageCount Value="178"/> 200 203 <DefaultSyntaxHighlighter Value="JScript"/> 201 204 </Unit16> … … 206 209 <TopLine Value="608"/> 207 210 <CursorPos X="44" Y="627"/> 208 <UsageCount Value="1 11"/>211 <UsageCount Value="109"/> 209 212 <DefaultSyntaxHighlighter Value="Delphi"/> 210 213 </Unit17> … … 215 218 <TopLine Value="39"/> 216 219 <CursorPos X="25" Y="58"/> 217 <UsageCount Value="1 11"/>220 <UsageCount Value="109"/> 218 221 <DefaultSyntaxHighlighter Value="Delphi"/> 219 222 </Unit18> … … 224 227 <TopLine Value="1"/> 225 228 <CursorPos X="69" Y="19"/> 226 <UsageCount Value="10 7"/>229 <UsageCount Value="105"/> 227 230 <DefaultSyntaxHighlighter Value="Delphi"/> 228 231 </Unit19> … … 233 236 <TopLine Value="1"/> 234 237 <CursorPos X="52" Y="124"/> 235 <UsageCount Value="10 4"/>238 <UsageCount Value="102"/> 236 239 <DefaultSyntaxHighlighter Value="Delphi"/> 237 240 </Unit20> … … 241 244 <TopLine Value="1"/> 242 245 <CursorPos X="19" Y="4"/> 243 <UsageCount Value=" 2"/>246 <UsageCount Value="0"/> 244 247 <DefaultSyntaxHighlighter Value="Delphi"/> 245 248 </Unit21> … … 250 253 <TopLine Value="29"/> 251 254 <CursorPos X="2" Y="38"/> 252 <UsageCount Value="3 2"/>255 <UsageCount Value="30"/> 253 256 <DefaultSyntaxHighlighter Value="Delphi"/> 254 257 </Unit22> … … 259 262 <TopLine Value="62"/> 260 263 <CursorPos X="6" Y="62"/> 261 <UsageCount Value=" 9"/>264 <UsageCount Value="7"/> 262 265 <DefaultSyntaxHighlighter Value="Delphi"/> 263 266 </Unit23> … … 268 271 <TopLine Value="125"/> 269 272 <CursorPos X="9" Y="141"/> 270 <UsageCount Value=" 9"/>273 <UsageCount Value="7"/> 271 274 <DefaultSyntaxHighlighter Value="Delphi"/> 272 275 </Unit24> … … 277 280 <TopLine Value="1"/> 278 281 <CursorPos X="1" Y="1"/> 279 <UsageCount Value=" 9"/>282 <UsageCount Value="7"/> 280 283 <DefaultSyntaxHighlighter Value="Delphi"/> 281 284 </Unit25> … … 286 289 <TopLine Value="103"/> 287 290 <CursorPos X="29" Y="112"/> 288 <UsageCount Value=" 9"/>291 <UsageCount Value="7"/> 289 292 <DefaultSyntaxHighlighter Value="Delphi"/> 290 293 </Unit26> … … 295 298 <TopLine Value="1"/> 296 299 <CursorPos X="12" Y="10"/> 297 <UsageCount Value=" 9"/>300 <UsageCount Value="7"/> 298 301 <DefaultSyntaxHighlighter Value="Delphi"/> 299 302 </Unit27> … … 304 307 <TopLine Value="1"/> 305 308 <CursorPos X="8" Y="1"/> 306 <UsageCount Value=" 7"/>309 <UsageCount Value="5"/> 307 310 <DefaultSyntaxHighlighter Value="Delphi"/> 308 311 </Unit28> … … 313 316 <TopLine Value="1803"/> 314 317 <CursorPos X="39" Y="1806"/> 315 <UsageCount Value=" 9"/>318 <UsageCount Value="7"/> 316 319 <DefaultSyntaxHighlighter Value="Delphi"/> 317 320 </Unit29> … … 322 325 <TopLine Value="173"/> 323 326 <CursorPos X="10" Y="192"/> 324 <UsageCount Value=" 7"/>327 <UsageCount Value="5"/> 325 328 <DefaultSyntaxHighlighter Value="Delphi"/> 326 329 </Unit30> … … 331 334 <TopLine Value="31"/> 332 335 <CursorPos X="3" Y="49"/> 333 <UsageCount Value=" 9"/>336 <UsageCount Value="7"/> 334 337 <DefaultSyntaxHighlighter Value="Delphi"/> 335 338 </Unit31> … … 340 343 <TopLine Value="2569"/> 341 344 <CursorPos X="27" Y="2594"/> 342 <UsageCount Value=" 7"/>345 <UsageCount Value="5"/> 343 346 <DefaultSyntaxHighlighter Value="Delphi"/> 344 347 </Unit32> … … 349 352 <TopLine Value="112"/> 350 353 <CursorPos X="23" Y="125"/> 351 <UsageCount Value="1 8"/>354 <UsageCount Value="16"/> 352 355 <DefaultSyntaxHighlighter Value="Delphi"/> 353 356 </Unit33> … … 358 361 <TopLine Value="1"/> 359 362 <CursorPos X="1" Y="1"/> 360 <UsageCount Value="1 8"/>363 <UsageCount Value="16"/> 361 364 <DefaultSyntaxHighlighter Value="Delphi"/> 362 365 </Unit34> … … 367 370 <TopLine Value="543"/> 368 371 <CursorPos X="14" Y="556"/> 369 <UsageCount Value="3 1"/>372 <UsageCount Value="39"/> 370 373 <Loaded Value="True"/> 371 374 <DefaultSyntaxHighlighter Value="Delphi"/> … … 377 380 <TopLine Value="10"/> 378 381 <CursorPos X="22" Y="23"/> 379 <UsageCount Value="3 1"/>382 <UsageCount Value="39"/> 380 383 <Loaded Value="True"/> 381 384 <DefaultSyntaxHighlighter Value="Delphi"/> … … 388 391 <TopLine Value="1140"/> 389 392 <CursorPos X="26" Y="1143"/> 390 <UsageCount Value="3 1"/>393 <UsageCount Value="39"/> 391 394 <Loaded Value="True"/> 392 395 <DefaultSyntaxHighlighter Value="Delphi"/> … … 398 401 <TopLine Value="43"/> 399 402 <CursorPos X="5" Y="61"/> 400 <UsageCount Value="3 1"/>403 <UsageCount Value="39"/> 401 404 <Loaded Value="True"/> 402 405 <DefaultSyntaxHighlighter Value="Delphi"/> … … 408 411 <TopLine Value="50"/> 409 412 <CursorPos X="10" Y="63"/> 410 <UsageCount Value="3 1"/>413 <UsageCount Value="39"/> 411 414 <Loaded Value="True"/> 412 415 <DefaultSyntaxHighlighter Value="Delphi"/> … … 416 419 <IsPartOfProject Value="True"/> 417 420 <UnitName Value="UStringListEx"/> 418 <EditorIndex Value=" 2"/>421 <EditorIndex Value="1"/> 419 422 <WindowIndex Value="0"/> 420 423 <TopLine Value="1"/> 421 424 <CursorPos X="46" Y="11"/> 422 <UsageCount Value=" 62"/>425 <UsageCount Value="78"/> 423 426 <Loaded Value="True"/> 424 427 <DefaultSyntaxHighlighter Value="Delphi"/> … … 430 433 <TopLine Value="8"/> 431 434 <CursorPos X="17" Y="19"/> 432 <UsageCount Value="5 9"/>435 <UsageCount Value="57"/> 433 436 <DefaultSyntaxHighlighter Value="Delphi"/> 434 437 </Unit41> … … 436 439 <Filename Value="Common/UDatabase.pas"/> 437 440 <IsPartOfProject Value="True"/> 438 <UsageCount Value=" 62"/>441 <UsageCount Value="78"/> 439 442 <DefaultSyntaxHighlighter Value="Delphi"/> 440 443 </Unit42> … … 443 446 <IsPartOfProject Value="True"/> 444 447 <UnitName Value="UHtmlClasses"/> 445 <EditorIndex Value=" 29"/>446 <WindowIndex Value="0"/> 447 <TopLine Value=" 218"/>448 <CursorPos X=" 1" Y="231"/>449 <UsageCount Value=" 62"/>448 <EditorIndex Value="30"/> 449 <WindowIndex Value="0"/> 450 <TopLine Value="132"/> 451 <CursorPos X="5" Y="149"/> 452 <UsageCount Value="78"/> 450 453 <Loaded Value="True"/> 451 454 <DefaultSyntaxHighlighter Value="Delphi"/> … … 455 458 <IsPartOfProject Value="True"/> 456 459 <UnitName Value="USqlDatabase"/> 457 <EditorIndex Value="2 5"/>460 <EditorIndex Value="26"/> 458 461 <WindowIndex Value="0"/> 459 462 <TopLine Value="215"/> 460 463 <CursorPos X="49" Y="233"/> 461 <UsageCount Value=" 62"/>464 <UsageCount Value="78"/> 462 465 <Loaded Value="True"/> 463 466 <DefaultSyntaxHighlighter Value="Delphi"/> … … 471 474 <TopLine Value="13"/> 472 475 <CursorPos X="5" Y="32"/> 473 <UsageCount Value=" 62"/>476 <UsageCount Value="78"/> 474 477 <Loaded Value="True"/> 475 478 <DefaultSyntaxHighlighter Value="Delphi"/> … … 481 484 <TopLine Value="99"/> 482 485 <CursorPos X="33" Y="117"/> 483 <UsageCount Value=" 60"/>486 <UsageCount Value="58"/> 484 487 <DefaultSyntaxHighlighter Value="Delphi"/> 485 488 </Unit46> … … 489 492 <TopLine Value="501"/> 490 493 <CursorPos X="10" Y="503"/> 491 <UsageCount Value=" 7"/>494 <UsageCount Value="5"/> 492 495 <DefaultSyntaxHighlighter Value="Delphi"/> 493 496 </Unit47> 494 497 <Unit48> 495 498 <Filename Value="/usr/share/fpcsrc/rtl/inc/mathh.inc"/> 496 <EditorIndex Value="3 0"/>497 <WindowIndex Value="0"/> 498 <TopLine Value="6 4"/>499 <EditorIndex Value="31"/> 500 <WindowIndex Value="0"/> 501 <TopLine Value="61"/> 499 502 <CursorPos X="14" Y="78"/> 500 <UsageCount Value="3 0"/>503 <UsageCount Value="38"/> 501 504 <Loaded Value="True"/> 502 505 <DefaultSyntaxHighlighter Value="Delphi"/> … … 504 507 <Unit49> 505 508 <Filename Value="/usr/share/fpcsrc/rtl/inc/systemh.inc"/> 506 <EditorIndex Value="2 7"/>509 <EditorIndex Value="28"/> 507 510 <WindowIndex Value="0"/> 508 511 <TopLine Value="476"/> 509 512 <CursorPos X="3" Y="489"/> 510 <UsageCount Value=" 26"/>513 <UsageCount Value="34"/> 511 514 <Loaded Value="True"/> 512 515 <DefaultSyntaxHighlighter Value="Delphi"/> … … 514 517 <Unit50> 515 518 <Filename Value="/usr/share/fpcsrc/rtl/objpas/sysutils/dati.inc"/> 516 <EditorIndex Value="3 2"/>519 <EditorIndex Value="33"/> 517 520 <WindowIndex Value="0"/> 518 521 <TopLine Value="519"/> 519 522 <CursorPos X="23" Y="526"/> 520 <UsageCount Value=" 26"/>523 <UsageCount Value="34"/> 521 524 <Loaded Value="True"/> 522 525 <DefaultSyntaxHighlighter Value="Delphi"/> … … 530 533 <TopLine Value="1"/> 531 534 <CursorPos X="53" Y="18"/> 532 <UsageCount Value=" 45"/>535 <UsageCount Value="61"/> 533 536 <Loaded Value="True"/> 534 537 <DefaultSyntaxHighlighter Value="Delphi"/> … … 538 541 <IsPartOfProject Value="True"/> 539 542 <UnitName Value="UUser"/> 540 <EditorIndex Value="2 8"/>541 <WindowIndex Value="0"/> 542 <TopLine Value=" 1"/>543 <CursorPos X="56" Y=" 10"/>544 <UsageCount Value=" 24"/>543 <EditorIndex Value="29"/> 544 <WindowIndex Value="0"/> 545 <TopLine Value="42"/> 546 <CursorPos X="56" Y="66"/> 547 <UsageCount Value="40"/> 545 548 <Loaded Value="True"/> 546 549 <DefaultSyntaxHighlighter Value="Delphi"/> … … 554 557 <TopLine Value="76"/> 555 558 <CursorPos X="29" Y="94"/> 556 <UsageCount Value=" 23"/>559 <UsageCount Value="39"/> 557 560 <Loaded Value="True"/> 558 561 <DefaultSyntaxHighlighter Value="Delphi"/> … … 566 569 <TopLine Value="28"/> 567 570 <CursorPos X="18" Y="45"/> 568 <UsageCount Value=" 23"/>571 <UsageCount Value="39"/> 569 572 <Loaded Value="True"/> 570 573 <DefaultSyntaxHighlighter Value="Delphi"/> … … 578 581 <TopLine Value="148"/> 579 582 <CursorPos X="52" Y="165"/> 580 <UsageCount Value=" 23"/>583 <UsageCount Value="39"/> 581 584 <Loaded Value="True"/> 582 585 <DefaultSyntaxHighlighter Value="Delphi"/> … … 586 589 <IsPartOfProject Value="True"/> 587 590 <UnitName Value="UHTTPServer"/> 588 <IsVisibleTab Value="True"/>589 591 <EditorIndex Value="13"/> 590 592 <WindowIndex Value="0"/> 591 <TopLine Value=" 126"/>592 <CursorPos X=" 7" Y="143"/>593 <UsageCount Value=" 23"/>593 <TopLine Value="34"/> 594 <CursorPos X="3" Y="53"/> 595 <UsageCount Value="39"/> 594 596 <Loaded Value="True"/> 595 597 <DefaultSyntaxHighlighter Value="Delphi"/> … … 603 605 <TopLine Value="82"/> 604 606 <CursorPos X="65" Y="100"/> 605 <UsageCount Value=" 23"/>607 <UsageCount Value="39"/> 606 608 <Loaded Value="True"/> 607 609 <DefaultSyntaxHighlighter Value="Delphi"/> … … 615 617 <TopLine Value="27"/> 616 618 <CursorPos X="3" Y="29"/> 617 <UsageCount Value=" 23"/>619 <UsageCount Value="39"/> 618 620 <Loaded Value="True"/> 619 621 <DefaultSyntaxHighlighter Value="Delphi"/> … … 627 629 <TopLine Value="1"/> 628 630 <CursorPos X="6" Y="15"/> 629 <UsageCount Value=" 22"/>631 <UsageCount Value="38"/> 630 632 <Loaded Value="True"/> 631 633 <DefaultSyntaxHighlighter Value="Delphi"/> … … 637 639 <EditorIndex Value="18"/> 638 640 <WindowIndex Value="0"/> 639 <TopLine Value="1 19"/>640 <CursorPos X=" 66" Y="143"/>641 <UsageCount Value=" 22"/>641 <TopLine Value="1"/> 642 <CursorPos X="46" Y="19"/> 643 <UsageCount Value="38"/> 642 644 <Loaded Value="True"/> 643 645 <DefaultSyntaxHighlighter Value="Delphi"/> … … 651 653 <TopLine Value="74"/> 652 654 <CursorPos X="52" Y="92"/> 653 <UsageCount Value=" 22"/>655 <UsageCount Value="38"/> 654 656 <Loaded Value="True"/> 655 657 <DefaultSyntaxHighlighter Value="Delphi"/> … … 663 665 <TopLine Value="12"/> 664 666 <CursorPos X="15" Y="25"/> 665 <UsageCount Value=" 22"/>667 <UsageCount Value="38"/> 666 668 <Loaded Value="True"/> 667 669 <DefaultSyntaxHighlighter Value="Delphi"/> … … 675 677 <TopLine Value="660"/> 676 678 <CursorPos X="3" Y="687"/> 677 <UsageCount Value=" 22"/>679 <UsageCount Value="38"/> 678 680 <Loaded Value="True"/> 679 681 <DefaultSyntaxHighlighter Value="Delphi"/> … … 686 688 <TopLine Value="383"/> 687 689 <CursorPos X="15" Y="397"/> 688 <UsageCount Value="1 1"/>690 <UsageCount Value="19"/> 689 691 <Loaded Value="True"/> 690 692 </Unit64> … … 693 695 <IsPartOfProject Value="True"/> 694 696 <UnitName Value="UCustomApplication"/> 695 <EditorIndex Value=" 1"/>696 <WindowIndex Value="0"/> 697 <TopLine Value=" 74"/>698 <CursorPos X=" 44" Y="86"/>699 <UsageCount Value=" 22"/>697 <EditorIndex Value="2"/> 698 <WindowIndex Value="0"/> 699 <TopLine Value="89"/> 700 <CursorPos X="1" Y="114"/> 701 <UsageCount Value="38"/> 700 702 <Loaded Value="True"/> 701 703 <DefaultSyntaxHighlighter Value="Delphi"/> … … 707 709 <TopLine Value="690"/> 708 710 <CursorPos X="3" Y="695"/> 709 <UsageCount Value="1 1"/>711 <UsageCount Value="19"/> 710 712 <Loaded Value="True"/> 711 713 <DefaultSyntaxHighlighter Value="Delphi"/> 712 714 </Unit66> 715 <Unit67> 716 <Filename Value="Application/UPageList.pas"/> 717 <IsPartOfProject Value="True"/> 718 <UnitName Value="UPageList"/> 719 <IsVisibleTab Value="True"/> 720 <EditorIndex Value="25"/> 721 <WindowIndex Value="0"/> 722 <TopLine Value="67"/> 723 <CursorPos X="9" Y="96"/> 724 <UsageCount Value="35"/> 725 <Loaded Value="True"/> 726 <DefaultSyntaxHighlighter Value="Delphi"/> 727 </Unit67> 713 728 </Units> 714 729 <JumpHistory Count="30" HistoryIndex="29"> 715 730 <Position1> 716 <Filename Value=" WebServer/UHTTPSessionMySQL.pas"/>717 <Caret Line=" 38" Column="1" TopLine="25"/>731 <Filename Value="Application/UUser.pas"/> 732 <Caret Line="56" Column="1" TopLine="45"/> 718 733 </Position1> 719 734 <Position2> 720 <Filename Value=" WebServer/UHTTPSessionMySQL.pas"/>721 <Caret Line=" 40" Column="1" TopLine="25"/>735 <Filename Value="Application/UUser.pas"/> 736 <Caret Line="58" Column="1" TopLine="45"/> 722 737 </Position2> 723 738 <Position3> 724 <Filename Value=" WebServer/UHTTPSessionMySQL.pas"/>725 <Caret Line=" 41" Column="1" TopLine="25"/>739 <Filename Value="Application/UUser.pas"/> 740 <Caret Line="59" Column="1" TopLine="45"/> 726 741 </Position3> 727 742 <Position4> 728 <Filename Value=" WebServer/UHTTPSessionMySQL.pas"/>729 <Caret Line=" 42" Column="1" TopLine="25"/>743 <Filename Value="Application/UUser.pas"/> 744 <Caret Line="60" Column="1" TopLine="45"/> 730 745 </Position4> 731 746 <Position5> 732 <Filename Value=" WebServer/UHTTPSessionMySQL.pas"/>733 <Caret Line=" 43" Column="1" TopLine="25"/>747 <Filename Value="Application/UCustomApplication.pas"/> 748 <Caret Line="243" Column="40" TopLine="229"/> 734 749 </Position5> 735 750 <Position6> 736 <Filename Value=" WebServer/UHTTPSessionMySQL.pas"/>737 <Caret Line=" 44" Column="1" TopLine="25"/>751 <Filename Value="Application/UCustomApplication.pas"/> 752 <Caret Line="244" Column="1" TopLine="229"/> 738 753 </Position6> 739 754 <Position7> 740 <Filename Value=" WebServer/UHTTPSessionMySQL.pas"/>741 <Caret Line=" 46" Column="1" TopLine="25"/>755 <Filename Value="Application/UUser.pas"/> 756 <Caret Line="60" Column="17" TopLine="25"/> 742 757 </Position7> 743 758 <Position8> 744 <Filename Value=" WebServer/UHTTPSessionMySQL.pas"/>745 <Caret Line=" 48" Column="1" TopLine="26"/>759 <Filename Value="Application/UUser.pas"/> 760 <Caret Line="53" Column="1" TopLine="25"/> 746 761 </Position8> 747 762 <Position9> 748 <Filename Value=" WebServer/UHTTPSessionMySQL.pas"/>749 <Caret Line=" 49" Column="1" TopLine="27"/>763 <Filename Value="Application/UUser.pas"/> 764 <Caret Line="54" Column="1" TopLine="25"/> 750 765 </Position9> 751 766 <Position10> 752 <Filename Value=" WebServer/UHTTPSessionMySQL.pas"/>753 <Caret Line=" 74" Column="9" TopLine="64"/>767 <Filename Value="Application/UUser.pas"/> 768 <Caret Line="55" Column="1" TopLine="25"/> 754 769 </Position10> 755 770 <Position11> 756 <Filename Value=" WebServer/UHTTPServerCGI.pas"/>757 <Caret Line=" 31" Column="16" TopLine="16"/>771 <Filename Value="Application/UUser.pas"/> 772 <Caret Line="56" Column="1" TopLine="25"/> 758 773 </Position11> 759 774 <Position12> 760 <Filename Value=" WebServer/UHTTPServerCGI.pas"/>761 <Caret Line=" 23" Column="1" TopLine="1"/>775 <Filename Value="Application/UUser.pas"/> 776 <Caret Line="58" Column="1" TopLine="38"/> 762 777 </Position12> 763 778 <Position13> 764 <Filename Value=" WebServer/UHTTPServerCGI.pas"/>765 <Caret Line=" 143" Column="47" TopLine="123"/>779 <Filename Value="Application/UUser.pas"/> 780 <Caret Line="59" Column="1" TopLine="38"/> 766 781 </Position13> 767 782 <Position14> 768 <Filename Value=" WebServer/UHTTPServerCGI.pas"/>769 <Caret Line=" 122" Column="88" TopLine="109"/>783 <Filename Value="Application/UUser.pas"/> 784 <Caret Line="60" Column="1" TopLine="38"/> 770 785 </Position14> 771 786 <Position15> 772 <Filename Value=" WebServer/UHTTPServerCGI.pas"/>773 <Caret Line=" 144" Column="58" TopLine="114"/>787 <Filename Value="Application/UCustomApplication.pas"/> 788 <Caret Line="244" Column="21" TopLine="229"/> 774 789 </Position15> 775 790 <Position16> 776 <Filename Value=" Common/UStringListEx.pas"/>777 <Caret Line=" 32" Column="1" TopLine="18"/>791 <Filename Value="Application/UUser.pas"/> 792 <Caret Line="68" Column="17" TopLine="40"/> 778 793 </Position16> 779 794 <Position17> 780 <Filename Value=" WebServer/UHTTPServerCGI.pas"/>781 <Caret Line=" 139" Column="50" TopLine="121"/>795 <Filename Value="Pages/UMainPage.pas"/> 796 <Caret Line="329" Column="4" TopLine="306"/> 782 797 </Position17> 783 798 <Position18> 784 <Filename Value=" WebServer/UHTTPServerCGI.pas"/>785 <Caret Line=" 145" Column="32" TopLine="121"/>799 <Filename Value="Pages/UMainPage.pas"/> 800 <Caret Line="327" Column="33" TopLine="306"/> 786 801 </Position18> 787 802 <Position19> 788 <Filename Value=" WebServer/UHTTPServerCGI.pas"/>789 <Caret Line=" 122" Column="102" TopLine="121"/>803 <Filename Value="Pages/UMainPage.pas"/> 804 <Caret Line="339" Column="35" TopLine="306"/> 790 805 </Position19> 791 806 <Position20> 792 <Filename Value=" WebServer/UHTTPServer.pas"/>793 <Caret Line="3 99" Column="18" TopLine="392"/>807 <Filename Value="Pages/UMainPage.pas"/> 808 <Caret Line="333" Column="76" TopLine="313"/> 794 809 </Position20> 795 810 <Position21> 796 <Filename Value=" WebServer/UHTTPServer.pas"/>797 <Caret Line=" 394" Column="37" TopLine="378"/>811 <Filename Value="Application/UPageList.pas"/> 812 <Caret Line="19" Column="24" TopLine="1"/> 798 813 </Position21> 799 814 <Position22> 800 <Filename Value=" WebServer/UHTTPServer.pas"/>801 <Caret Line=" 105" Column="83" TopLine="87"/>815 <Filename Value="Application/UPageList.pas"/> 816 <Caret Line="64" Column="30" TopLine="45"/> 802 817 </Position22> 803 818 <Position23> 804 <Filename Value=" WebServer/UHTTPServer.pas"/>805 <Caret Line=" 173" Column="41" TopLine="168"/>819 <Filename Value="Application/UPageList.pas"/> 820 <Caret Line="42" Column="21" TopLine="25"/> 806 821 </Position23> 807 822 <Position24> 808 <Filename Value="Application/U CustomApplication.pas"/>809 <Caret Line=" 95" Column="25" TopLine="83"/>823 <Filename Value="Application/UPageList.pas"/> 824 <Caret Line="43" Column="62" TopLine="26"/> 810 825 </Position24> 811 826 <Position25> 812 <Filename Value=" WebServer/UHTTPServer.pas"/>813 <Caret Line=" 105" Column="72" TopLine="92"/>827 <Filename Value="Application/UPageList.pas"/> 828 <Caret Line="50" Column="20" TopLine="33"/> 814 829 </Position25> 815 830 <Position26> 816 <Filename Value=" WebServer/UHTTPServerCGI.pas"/>817 <Caret Line=" 44" Column="38" TopLine="39"/>831 <Filename Value="Application/UPageList.pas"/> 832 <Caret Line="95" Column="4" TopLine="65"/> 818 833 </Position26> 819 834 <Position27> 820 <Filename Value="Application/U CustomApplication.pas"/>821 <Caret Line="2 52" Column="6" TopLine="232"/>835 <Filename Value="Application/UPageList.pas"/> 836 <Caret Line="20" Column="21" TopLine="1"/> 822 837 </Position27> 823 838 <Position28> 824 <Filename Value="Application/U CustomApplication.pas"/>825 <Caret Line=" 31" Column="25" TopLine="18"/>839 <Filename Value="Application/UPageList.pas"/> 840 <Caret Line="14" Column="24" TopLine="1"/> 826 841 </Position28> 827 842 <Position29> 828 <Filename Value=" WebServer/UHTTPSessionMySQL.pas"/>829 <Caret Line=" 97" Column="21" TopLine="85"/>843 <Filename Value="Application/UPageList.pas"/> 844 <Caret Line="54" Column="21" TopLine="37"/> 830 845 </Position29> 831 846 <Position30> 832 <Filename Value=" WebServer/UHTTPServer.pas"/>833 <Caret Line=" 56" Column="27" TopLine="43"/>847 <Filename Value="Application/UPageList.pas"/> 848 <Caret Line="70" Column="30" TopLine="58"/> 834 849 </Position30> 835 850 </JumpHistory> … … 841 856 </Target> 842 857 <SearchPaths> 843 <OtherUnitFiles Value="/usr/lib/mysql/;/usr/lib64/mysql/;Pages /;Common/;Application/;WebServer/;Network/"/>858 <OtherUnitFiles Value="/usr/lib/mysql/;/usr/lib64/mysql/;Pages;Common;Application;WebServer;Network"/> 844 859 <UnitOutputDirectory Value="bin"/> 845 860 <LCLWidgetType Value="gtk2"/> -
trunk/CGI.lpr
r35 r36 7 7 UMainPage, UCustomApplication, UUser, UHTTPSessionMySQL, UHTTPSessionFile, 8 8 UCommon, UHTTPServer, UHTTPServerTCP, UHTTPServerCGI, UTCPServer, UPool, 9 UMemoryStreamEx, UMIMEType ;9 UMemoryStreamEx, UMIMEType, UPageList; 10 10 11 11 var … … 25 25 RegisterPage('serverinfo', ServerInfo); 26 26 RegisterPage('kamery', WebCam); 27 RegisterPage('uzivatel', UserControl); 27 28 RegisterPage('', About); 28 29 HTTPServer := THTTPServerCGI.Create; -
trunk/Common/UHtmlClasses.pas
r25 r36 140 140 Scripts: TStringList; 141 141 property AsXmlDocument: TXmlDocument read GetAsXmlDocument; 142 constructor Create; 143 destructor Destroy; override; 144 end; 145 146 { TQueryString } 147 148 TQueryString = class 149 Data: TStringList; 150 procedure SetStringServer; 151 procedure SetString(QueryString: string); 152 function GetString: string; 142 153 constructor Create; 143 154 destructor Destroy; override; … … 560 571 end; 561 572 573 procedure TQueryString.SetStringServer; 574 begin 575 //$this->SetString($_SERVER['QUERY_STRING']); 576 end; 577 578 procedure TQueryString.SetString(QueryString: string); 579 begin 580 (* 581 $this->Data = array(); 582 $Parts = explode('&', $QueryString); 583 foreach($Parts as $Part) 584 { 585 if($Part != '') 586 { 587 $Item = explode('=', $Part); 588 $this->Data[$Item[0]] = $Item[1]; 589 end; 590 end;*) 591 end; 592 593 function TQueryString.GetString: string; 594 begin 595 (*$Parts = array(); 596 foreach($this->Data as $Index => $Item) 597 { 598 $Parts[] = $Index.'='.$Item; 599 } 600 return(implode('&', $Parts));*) 601 end; 602 603 constructor TQueryString.Create; 604 begin 605 Data := TStringList.Create; 606 end; 607 608 destructor TQueryString.Destroy; 609 begin 610 Data.Free; 611 inherited Destroy; 612 end; 613 562 614 end. -
trunk/Pages/UMainPage.pas
r35 r36 19 19 procedure ServerInfo(App: TCustomApplication; HandlerData: THTTPHandlerData); 20 20 procedure WebCam(App: TCustomApplication; HandlerData: THTTPHandlerData); 21 procedure UserControl(App: TCustomApplication; HandlerData: THTTPHandlerData); 21 22 22 23 implementation … … 159 160 '<br /><div align="center"><img name="theImage" src="" idth="640" height="480" alt="Webcam image"><br>Poslední aktualizace: ' + 160 161 DateTimeToStr(FileDateToDateTime(FileAge(WebCamImage))) + '<br>Obnovování po ' + IntToStr(RefreshInterval) + ' sekundách</div><br />'; 161 end else Text := '<br />Obrázek nenalezen.<br /><br />';162 end else Text := Text + '<br />Obrázek nenalezen.<br /><br />'; 162 163 Text := Text + '</td></tr></table>'; 163 164 end; … … 316 317 'Provozovatel: Ing. Jiří Hajda<br/>' + 317 318 'Adresa: Zděchov 208, 75607<br/>' + 318 'Telef ón: 737785792<br/>' +319 'Telefon: 737785792<br/>' + 319 320 'E-mail: <a href="mailto: robie@centrum.cz">robie@centrum.cz</a><br/>' + 321 'ICQ: <a href="http://www.icq.com/people/277158770">277158770</a><br/>' + 320 322 'IČ: 75904535<br/>' + 321 323 'DIČ: CZ8303255884<br/>' + … … 324 326 end; 325 327 328 procedure UserControl(App: TCustomApplication; HandlerData: THTTPHandlerData); 329 var 330 PageName: string; 331 begin 332 App.HtmlDocument.Title := 'Uživatel'; 333 334 if HandlerData.Request.QueryParts.Count > 1 then PageName := HandlerData.Request.QueryParts[1] 335 else PageName := ''; 336 with App.HtmlDocument.Body, THtmlString(SubItems[SubItems.Add(THtmlString.Create)]) do begin 337 if PageName = 'prihlaseni' then begin 338 Text := 'Login'; 339 340 end else Text := ''; 341 end; 342 end; 343 344 326 345 procedure ServerInfo(App: TCustomApplication; HandlerData: THTTPHandlerData); 327 346 begin -
trunk/WebServer/UHTTPSessionMySQL.pas
r34 r36 67 67 try 68 68 Lock.Acquire; 69 DbRows := SqlDatabase.Query('DELETE FROM `HTTPSession` WHERE `Time` < DATE_SUB(NOW(), INTERVAL ' + 70 IntToStr(Timeout) +' SECOND)'); 71 DbRows.Free; 69 72 DbRows := SqlDatabase.Query('SELECT * FROM `HTTPSession` WHERE `Identification`="' + 70 73 HandlerData.SessionId + '"'); … … 110 113 Sessions := TStringList.Create; 111 114 SessionIdCookieName := 'SessionId'; 112 Timeout := 3 600;115 Timeout := 3 * 3600; 113 116 end; 114 117
Note:
See TracChangeset
for help on using the changeset viewer.