Changeset 36 for trunk


Ignore:
Timestamp:
Oct 29, 2010, 10:44:13 PM (14 years ago)
Author:
george
Message:
  • Přidáno: Neodokončená třída TPageList a TQueryString.
  • Přidáno: Částečná podpora pro přihlašování uživatelů.
Location:
trunk
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/UCustomApplication.pas

    r35 r36  
    88  Classes, SysUtils, UHTTPServerCGI, Contnrs, USqlDatabase, UConfig, DateUtils,
    99  UXmlClasses, UHtmlClasses, UCore, UStringListEx, UHTTPServer, UHTTPServerTCP,
    10   UHTTPSessionMySQL, UHTTPSessionFile;
     10  UHTTPSessionMySQL, UHTTPSessionFile, UUser;
    1111
    1212type
     
    4646    ModuleName: string;
    4747    BaseURL: string;
     48    User: TWebUser;
     49    UserOnline: TWebOnlineUser;
    4850    procedure Run;
    4951    procedure Execute(HandlerData: THTTPHandlerData);
     
    9597  TitleTag: THtmlString;
    9698begin
     99  User.HandlerData := HandlerData;
     100  UserOnline.HandlerData := HandlerData;
     101  UserOnline.Update;
    97102  with HandlerData do begin
    98103  Style := ConfigStyle;
     
    133138  Pages := TObjectList.Create;
    134139  HtmlDocument := THtmlDocument.Create;
     140  User := TWebUser.Create;
     141  User.Database := Database;
     142  UserOnline := TWebOnlineUser.Create;
     143  UserOnline.Database := Database;
    135144end;
    136145
     
    141150  Pages.Free;
    142151  HTTPServer.Free;
     152  User.Free;
     153  UserOnline.Free;
    143154  inherited Destroy;
    144155end;
     
    230241      '<li><a href="https://mail.zdechov.net/">Pošta</a></li>' +
    231242      '<li><a href="http://wiki.zdechov.net/">Wiki</a></li>' +
    232       '</ul><ul class="MenuItem2"><li>&nbsp;</li>';
    233 (*    if System.UserOnline.User = System.UserOnline.AnonymousUserId then begin
     243      '</ul><ul class="MenuItem2">'; //<li>&nbsp;</li>';
     244    if UserOnline.User = AnonymousUserId then begin
    234245      Text := Text + '</ul>' +
    235246        '<ul class="MenuItem2">' +
    236         '<li>' + MakeLink('Přihlášení', NavigationMakeLink('User', 'Login')) + '</li>';
     247        '<li>' + MakeLink('Přihlášení', NavigationLink('/uzivatel/prihlaseni/')) + '</li>';
    237248      //$Output .= '<li>'.$this->System->HTML->MakeLink($this->System->Translate('UserRegistration'), $this->System->MakeLink('UserList', 'Register')).'</li>';
    238249    end else begin
    239250      Text := Text + '</ul>' +
    240251        '<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;
    247256    Text := Text + '</ul></div>';
    248257  end;
  • trunk/Application/UUser.pas

    r33 r36  
    88  Classes, SysUtils, synacode, USqlDatabase, UCommon, UHTTPServer;
    99
     10const
     11  AnonymousUserId = 1;
     12
    1013type
    1114  EDuplicateItem = class(Exception);
     
    1518
    1619  TWebUser = class
     20    FullName: string;
    1721    Database: TSqlDatabase;
    1822    HandlerData: THTTPHandlerData;
     
    4751  Id: Integer;
    4852begin
    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
    5471    DbRows.Free;
    55     DbRows := Database.Query('UPDATE `UserOnline` SET `ActivityTime` = NOW() WHERE `Id`=' + IntToStr(Id));
    56   end else begin
    57     // Create new record
    58     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;
    6272  end;
    63   DbRows.Destroy;
    6473end;
    6574
     
    6978begin
    7079  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;
    7486  Self.User := User;
    7587end;
     
    7991  DbRows: TDbRows;
    8092begin
    81   if Id = 1 then Update;
    82   if User <> 1 then begin
    83     DbRows := Database.Query('UPDATE `UserOnline` SET `User` = 1 WHERE `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`="' +
    8496      HandlerData.Request.Cookies.Values['SessionId'] + '"');
    8597    DbRows.Destroy;
    86     User := 1;
     98    User := AnonymousUserId;
    8799  end;
    88100end;
  • trunk/CGI.lpi

    r34 r36  
    2121      <StringTable ProductVersion=""/>
    2222    </VersionInfo>
     23    <BuildModes Count="1">
     24      <Item1 Name="default" Default="True"/>
     25    </BuildModes>
    2326    <PublishOptions>
    2427      <Version Value="2"/>
     
    3942      </Item1>
    4043    </RequiredPackages>
    41     <Units Count="67">
     44    <Units Count="68">
    4245      <Unit0>
    4346        <Filename Value="CGI.lpr"/>
     
    4649        <EditorIndex Value="0"/>
    4750        <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"/>
    5154        <Loaded Value="True"/>
    5255        <LoadedDesigner Value="True"/>
     
    5962        <EditorIndex Value="24"/>
    6063        <WindowIndex Value="0"/>
    61         <TopLine Value="259"/>
    62         <CursorPos X="47" Y="281"/>
    63         <UsageCount Value="183"/>
     64        <TopLine Value="313"/>
     65        <CursorPos X="20" Y="316"/>
     66        <UsageCount Value="199"/>
    6467        <Loaded Value="True"/>
    6568        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    7174        <TopLine Value="291"/>
    7275        <CursorPos X="1" Y="311"/>
    73         <UsageCount Value="142"/>
     76        <UsageCount Value="140"/>
    7477        <DefaultSyntaxHighlighter Value="Delphi"/>
    7578      </Unit2>
    7679      <Unit3>
    7780        <Filename Value="UXmlClasses.pas"/>
    78         <UsageCount Value="142"/>
     81        <UsageCount Value="140"/>
    7982        <DefaultSyntaxHighlighter Value="Delphi"/>
    8083      </Unit3>
     
    8386        <IsPartOfProject Value="True"/>
    8487        <UnitName Value="UCore"/>
    85         <EditorIndex Value="33"/>
     88        <EditorIndex Value="34"/>
    8689        <WindowIndex Value="0"/>
    8790        <TopLine Value="37"/>
    8891        <CursorPos X="69" Y="51"/>
    89         <UsageCount Value="187"/>
     92        <UsageCount Value="203"/>
    9093        <Loaded Value="True"/>
    9194        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    97100        <TopLine Value="217"/>
    98101        <CursorPos X="5" Y="236"/>
    99         <UsageCount Value="142"/>
     102        <UsageCount Value="140"/>
    100103        <DefaultSyntaxHighlighter Value="Delphi"/>
    101104      </Unit5>
     
    106109        <TopLine Value="10"/>
    107110        <CursorPos X="27" Y="19"/>
    108         <UsageCount Value="142"/>
     111        <UsageCount Value="140"/>
    109112        <DefaultSyntaxHighlighter Value="Delphi"/>
    110113      </Unit6>
     
    114117        <TopLine Value="17"/>
    115118        <CursorPos X="34" Y="30"/>
    116         <UsageCount Value="142"/>
     119        <UsageCount Value="140"/>
    117120        <DefaultSyntaxHighlighter Value="Delphi"/>
    118121      </Unit7>
     
    123126        <TopLine Value="204"/>
    124127        <CursorPos X="25" Y="226"/>
    125         <UsageCount Value="142"/>
     128        <UsageCount Value="140"/>
    126129        <DefaultSyntaxHighlighter Value="Delphi"/>
    127130      </Unit8>
     
    132135        <TopLine Value="102"/>
    133136        <CursorPos X="25" Y="107"/>
    134         <UsageCount Value="142"/>
     137        <UsageCount Value="140"/>
    135138        <DefaultSyntaxHighlighter Value="Delphi"/>
    136139      </Unit9>
     
    140143        <TopLine Value="2320"/>
    141144        <CursorPos X="30" Y="2342"/>
    142         <UsageCount Value="11"/>
     145        <UsageCount Value="9"/>
    143146        <DefaultSyntaxHighlighter Value="Delphi"/>
    144147      </Unit10>
     
    149152        <TopLine Value="40"/>
    150153        <CursorPos X="9" Y="59"/>
    151         <UsageCount Value="130"/>
     154        <UsageCount Value="128"/>
    152155        <DefaultSyntaxHighlighter Value="Delphi"/>
    153156      </Unit11>
    154157      <Unit12>
    155158        <Filename Value="/usr/share/fpcsrc/rtl/objpas/sysutils/datih.inc"/>
    156         <EditorIndex Value="31"/>
     159        <EditorIndex Value="32"/>
    157160        <WindowIndex Value="0"/>
    158161        <TopLine Value="91"/>
    159162        <CursorPos X="10" Y="110"/>
    160         <UsageCount Value="30"/>
     163        <UsageCount Value="38"/>
    161164        <Loaded Value="True"/>
    162165        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    164167      <Unit13>
    165168        <Filename Value="/usr/share/fpcsrc/rtl/objpas/dateutil.inc"/>
    166         <EditorIndex Value="26"/>
     169        <EditorIndex Value="27"/>
    167170        <WindowIndex Value="0"/>
    168171        <TopLine Value="283"/>
    169172        <CursorPos X="10" Y="302"/>
    170         <UsageCount Value="23"/>
     173        <UsageCount Value="31"/>
    171174        <Loaded Value="True"/>
    172175        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    180183        <TopLine Value="1"/>
    181184        <CursorPos X="92" Y="11"/>
    182         <UsageCount Value="162"/>
     185        <UsageCount Value="178"/>
    183186        <Loaded Value="True"/>
    184187        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    189192        <TopLine Value="108"/>
    190193        <CursorPos X="1" Y="134"/>
    191         <UsageCount Value="162"/>
     194        <UsageCount Value="178"/>
    192195        <DefaultSyntaxHighlighter Value="None"/>
    193196      </Unit15>
     
    197200        <TopLine Value="1"/>
    198201        <CursorPos X="1" Y="1"/>
    199         <UsageCount Value="162"/>
     202        <UsageCount Value="178"/>
    200203        <DefaultSyntaxHighlighter Value="JScript"/>
    201204      </Unit16>
     
    206209        <TopLine Value="608"/>
    207210        <CursorPos X="44" Y="627"/>
    208         <UsageCount Value="111"/>
     211        <UsageCount Value="109"/>
    209212        <DefaultSyntaxHighlighter Value="Delphi"/>
    210213      </Unit17>
     
    215218        <TopLine Value="39"/>
    216219        <CursorPos X="25" Y="58"/>
    217         <UsageCount Value="111"/>
     220        <UsageCount Value="109"/>
    218221        <DefaultSyntaxHighlighter Value="Delphi"/>
    219222      </Unit18>
     
    224227        <TopLine Value="1"/>
    225228        <CursorPos X="69" Y="19"/>
    226         <UsageCount Value="107"/>
     229        <UsageCount Value="105"/>
    227230        <DefaultSyntaxHighlighter Value="Delphi"/>
    228231      </Unit19>
     
    233236        <TopLine Value="1"/>
    234237        <CursorPos X="52" Y="124"/>
    235         <UsageCount Value="104"/>
     238        <UsageCount Value="102"/>
    236239        <DefaultSyntaxHighlighter Value="Delphi"/>
    237240      </Unit20>
     
    241244        <TopLine Value="1"/>
    242245        <CursorPos X="19" Y="4"/>
    243         <UsageCount Value="2"/>
     246        <UsageCount Value="0"/>
    244247        <DefaultSyntaxHighlighter Value="Delphi"/>
    245248      </Unit21>
     
    250253        <TopLine Value="29"/>
    251254        <CursorPos X="2" Y="38"/>
    252         <UsageCount Value="32"/>
     255        <UsageCount Value="30"/>
    253256        <DefaultSyntaxHighlighter Value="Delphi"/>
    254257      </Unit22>
     
    259262        <TopLine Value="62"/>
    260263        <CursorPos X="6" Y="62"/>
    261         <UsageCount Value="9"/>
     264        <UsageCount Value="7"/>
    262265        <DefaultSyntaxHighlighter Value="Delphi"/>
    263266      </Unit23>
     
    268271        <TopLine Value="125"/>
    269272        <CursorPos X="9" Y="141"/>
    270         <UsageCount Value="9"/>
     273        <UsageCount Value="7"/>
    271274        <DefaultSyntaxHighlighter Value="Delphi"/>
    272275      </Unit24>
     
    277280        <TopLine Value="1"/>
    278281        <CursorPos X="1" Y="1"/>
    279         <UsageCount Value="9"/>
     282        <UsageCount Value="7"/>
    280283        <DefaultSyntaxHighlighter Value="Delphi"/>
    281284      </Unit25>
     
    286289        <TopLine Value="103"/>
    287290        <CursorPos X="29" Y="112"/>
    288         <UsageCount Value="9"/>
     291        <UsageCount Value="7"/>
    289292        <DefaultSyntaxHighlighter Value="Delphi"/>
    290293      </Unit26>
     
    295298        <TopLine Value="1"/>
    296299        <CursorPos X="12" Y="10"/>
    297         <UsageCount Value="9"/>
     300        <UsageCount Value="7"/>
    298301        <DefaultSyntaxHighlighter Value="Delphi"/>
    299302      </Unit27>
     
    304307        <TopLine Value="1"/>
    305308        <CursorPos X="8" Y="1"/>
    306         <UsageCount Value="7"/>
     309        <UsageCount Value="5"/>
    307310        <DefaultSyntaxHighlighter Value="Delphi"/>
    308311      </Unit28>
     
    313316        <TopLine Value="1803"/>
    314317        <CursorPos X="39" Y="1806"/>
    315         <UsageCount Value="9"/>
     318        <UsageCount Value="7"/>
    316319        <DefaultSyntaxHighlighter Value="Delphi"/>
    317320      </Unit29>
     
    322325        <TopLine Value="173"/>
    323326        <CursorPos X="10" Y="192"/>
    324         <UsageCount Value="7"/>
     327        <UsageCount Value="5"/>
    325328        <DefaultSyntaxHighlighter Value="Delphi"/>
    326329      </Unit30>
     
    331334        <TopLine Value="31"/>
    332335        <CursorPos X="3" Y="49"/>
    333         <UsageCount Value="9"/>
     336        <UsageCount Value="7"/>
    334337        <DefaultSyntaxHighlighter Value="Delphi"/>
    335338      </Unit31>
     
    340343        <TopLine Value="2569"/>
    341344        <CursorPos X="27" Y="2594"/>
    342         <UsageCount Value="7"/>
     345        <UsageCount Value="5"/>
    343346        <DefaultSyntaxHighlighter Value="Delphi"/>
    344347      </Unit32>
     
    349352        <TopLine Value="112"/>
    350353        <CursorPos X="23" Y="125"/>
    351         <UsageCount Value="18"/>
     354        <UsageCount Value="16"/>
    352355        <DefaultSyntaxHighlighter Value="Delphi"/>
    353356      </Unit33>
     
    358361        <TopLine Value="1"/>
    359362        <CursorPos X="1" Y="1"/>
    360         <UsageCount Value="18"/>
     363        <UsageCount Value="16"/>
    361364        <DefaultSyntaxHighlighter Value="Delphi"/>
    362365      </Unit34>
     
    367370        <TopLine Value="543"/>
    368371        <CursorPos X="14" Y="556"/>
    369         <UsageCount Value="31"/>
     372        <UsageCount Value="39"/>
    370373        <Loaded Value="True"/>
    371374        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    377380        <TopLine Value="10"/>
    378381        <CursorPos X="22" Y="23"/>
    379         <UsageCount Value="31"/>
     382        <UsageCount Value="39"/>
    380383        <Loaded Value="True"/>
    381384        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    388391        <TopLine Value="1140"/>
    389392        <CursorPos X="26" Y="1143"/>
    390         <UsageCount Value="31"/>
     393        <UsageCount Value="39"/>
    391394        <Loaded Value="True"/>
    392395        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    398401        <TopLine Value="43"/>
    399402        <CursorPos X="5" Y="61"/>
    400         <UsageCount Value="31"/>
     403        <UsageCount Value="39"/>
    401404        <Loaded Value="True"/>
    402405        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    408411        <TopLine Value="50"/>
    409412        <CursorPos X="10" Y="63"/>
    410         <UsageCount Value="31"/>
     413        <UsageCount Value="39"/>
    411414        <Loaded Value="True"/>
    412415        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    416419        <IsPartOfProject Value="True"/>
    417420        <UnitName Value="UStringListEx"/>
    418         <EditorIndex Value="2"/>
     421        <EditorIndex Value="1"/>
    419422        <WindowIndex Value="0"/>
    420423        <TopLine Value="1"/>
    421424        <CursorPos X="46" Y="11"/>
    422         <UsageCount Value="62"/>
     425        <UsageCount Value="78"/>
    423426        <Loaded Value="True"/>
    424427        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    430433        <TopLine Value="8"/>
    431434        <CursorPos X="17" Y="19"/>
    432         <UsageCount Value="59"/>
     435        <UsageCount Value="57"/>
    433436        <DefaultSyntaxHighlighter Value="Delphi"/>
    434437      </Unit41>
     
    436439        <Filename Value="Common/UDatabase.pas"/>
    437440        <IsPartOfProject Value="True"/>
    438         <UsageCount Value="62"/>
     441        <UsageCount Value="78"/>
    439442        <DefaultSyntaxHighlighter Value="Delphi"/>
    440443      </Unit42>
     
    443446        <IsPartOfProject Value="True"/>
    444447        <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"/>
    450453        <Loaded Value="True"/>
    451454        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    455458        <IsPartOfProject Value="True"/>
    456459        <UnitName Value="USqlDatabase"/>
    457         <EditorIndex Value="25"/>
     460        <EditorIndex Value="26"/>
    458461        <WindowIndex Value="0"/>
    459462        <TopLine Value="215"/>
    460463        <CursorPos X="49" Y="233"/>
    461         <UsageCount Value="62"/>
     464        <UsageCount Value="78"/>
    462465        <Loaded Value="True"/>
    463466        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    471474        <TopLine Value="13"/>
    472475        <CursorPos X="5" Y="32"/>
    473         <UsageCount Value="62"/>
     476        <UsageCount Value="78"/>
    474477        <Loaded Value="True"/>
    475478        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    481484        <TopLine Value="99"/>
    482485        <CursorPos X="33" Y="117"/>
    483         <UsageCount Value="60"/>
     486        <UsageCount Value="58"/>
    484487        <DefaultSyntaxHighlighter Value="Delphi"/>
    485488      </Unit46>
     
    489492        <TopLine Value="501"/>
    490493        <CursorPos X="10" Y="503"/>
    491         <UsageCount Value="7"/>
     494        <UsageCount Value="5"/>
    492495        <DefaultSyntaxHighlighter Value="Delphi"/>
    493496      </Unit47>
    494497      <Unit48>
    495498        <Filename Value="/usr/share/fpcsrc/rtl/inc/mathh.inc"/>
    496         <EditorIndex Value="30"/>
    497         <WindowIndex Value="0"/>
    498         <TopLine Value="64"/>
     499        <EditorIndex Value="31"/>
     500        <WindowIndex Value="0"/>
     501        <TopLine Value="61"/>
    499502        <CursorPos X="14" Y="78"/>
    500         <UsageCount Value="30"/>
     503        <UsageCount Value="38"/>
    501504        <Loaded Value="True"/>
    502505        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    504507      <Unit49>
    505508        <Filename Value="/usr/share/fpcsrc/rtl/inc/systemh.inc"/>
    506         <EditorIndex Value="27"/>
     509        <EditorIndex Value="28"/>
    507510        <WindowIndex Value="0"/>
    508511        <TopLine Value="476"/>
    509512        <CursorPos X="3" Y="489"/>
    510         <UsageCount Value="26"/>
     513        <UsageCount Value="34"/>
    511514        <Loaded Value="True"/>
    512515        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    514517      <Unit50>
    515518        <Filename Value="/usr/share/fpcsrc/rtl/objpas/sysutils/dati.inc"/>
    516         <EditorIndex Value="32"/>
     519        <EditorIndex Value="33"/>
    517520        <WindowIndex Value="0"/>
    518521        <TopLine Value="519"/>
    519522        <CursorPos X="23" Y="526"/>
    520         <UsageCount Value="26"/>
     523        <UsageCount Value="34"/>
    521524        <Loaded Value="True"/>
    522525        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    530533        <TopLine Value="1"/>
    531534        <CursorPos X="53" Y="18"/>
    532         <UsageCount Value="45"/>
     535        <UsageCount Value="61"/>
    533536        <Loaded Value="True"/>
    534537        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    538541        <IsPartOfProject Value="True"/>
    539542        <UnitName Value="UUser"/>
    540         <EditorIndex Value="28"/>
    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"/>
    545548        <Loaded Value="True"/>
    546549        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    554557        <TopLine Value="76"/>
    555558        <CursorPos X="29" Y="94"/>
    556         <UsageCount Value="23"/>
     559        <UsageCount Value="39"/>
    557560        <Loaded Value="True"/>
    558561        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    566569        <TopLine Value="28"/>
    567570        <CursorPos X="18" Y="45"/>
    568         <UsageCount Value="23"/>
     571        <UsageCount Value="39"/>
    569572        <Loaded Value="True"/>
    570573        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    578581        <TopLine Value="148"/>
    579582        <CursorPos X="52" Y="165"/>
    580         <UsageCount Value="23"/>
     583        <UsageCount Value="39"/>
    581584        <Loaded Value="True"/>
    582585        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    586589        <IsPartOfProject Value="True"/>
    587590        <UnitName Value="UHTTPServer"/>
    588         <IsVisibleTab Value="True"/>
    589591        <EditorIndex Value="13"/>
    590592        <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"/>
    594596        <Loaded Value="True"/>
    595597        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    603605        <TopLine Value="82"/>
    604606        <CursorPos X="65" Y="100"/>
    605         <UsageCount Value="23"/>
     607        <UsageCount Value="39"/>
    606608        <Loaded Value="True"/>
    607609        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    615617        <TopLine Value="27"/>
    616618        <CursorPos X="3" Y="29"/>
    617         <UsageCount Value="23"/>
     619        <UsageCount Value="39"/>
    618620        <Loaded Value="True"/>
    619621        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    627629        <TopLine Value="1"/>
    628630        <CursorPos X="6" Y="15"/>
    629         <UsageCount Value="22"/>
     631        <UsageCount Value="38"/>
    630632        <Loaded Value="True"/>
    631633        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    637639        <EditorIndex Value="18"/>
    638640        <WindowIndex Value="0"/>
    639         <TopLine Value="119"/>
    640         <CursorPos X="66" Y="143"/>
    641         <UsageCount Value="22"/>
     641        <TopLine Value="1"/>
     642        <CursorPos X="46" Y="19"/>
     643        <UsageCount Value="38"/>
    642644        <Loaded Value="True"/>
    643645        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    651653        <TopLine Value="74"/>
    652654        <CursorPos X="52" Y="92"/>
    653         <UsageCount Value="22"/>
     655        <UsageCount Value="38"/>
    654656        <Loaded Value="True"/>
    655657        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    663665        <TopLine Value="12"/>
    664666        <CursorPos X="15" Y="25"/>
    665         <UsageCount Value="22"/>
     667        <UsageCount Value="38"/>
    666668        <Loaded Value="True"/>
    667669        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    675677        <TopLine Value="660"/>
    676678        <CursorPos X="3" Y="687"/>
    677         <UsageCount Value="22"/>
     679        <UsageCount Value="38"/>
    678680        <Loaded Value="True"/>
    679681        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    686688        <TopLine Value="383"/>
    687689        <CursorPos X="15" Y="397"/>
    688         <UsageCount Value="11"/>
     690        <UsageCount Value="19"/>
    689691        <Loaded Value="True"/>
    690692      </Unit64>
     
    693695        <IsPartOfProject Value="True"/>
    694696        <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"/>
    700702        <Loaded Value="True"/>
    701703        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    707709        <TopLine Value="690"/>
    708710        <CursorPos X="3" Y="695"/>
    709         <UsageCount Value="11"/>
     711        <UsageCount Value="19"/>
    710712        <Loaded Value="True"/>
    711713        <DefaultSyntaxHighlighter Value="Delphi"/>
    712714      </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>
    713728    </Units>
    714729    <JumpHistory Count="30" HistoryIndex="29">
    715730      <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"/>
    718733      </Position1>
    719734      <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"/>
    722737      </Position2>
    723738      <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"/>
    726741      </Position3>
    727742      <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"/>
    730745      </Position4>
    731746      <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"/>
    734749      </Position5>
    735750      <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"/>
    738753      </Position6>
    739754      <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"/>
    742757      </Position7>
    743758      <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"/>
    746761      </Position8>
    747762      <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"/>
    750765      </Position9>
    751766      <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"/>
    754769      </Position10>
    755770      <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"/>
    758773      </Position11>
    759774      <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"/>
    762777      </Position12>
    763778      <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"/>
    766781      </Position13>
    767782      <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"/>
    770785      </Position14>
    771786      <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"/>
    774789      </Position15>
    775790      <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"/>
    778793      </Position16>
    779794      <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"/>
    782797      </Position17>
    783798      <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"/>
    786801      </Position18>
    787802      <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"/>
    790805      </Position19>
    791806      <Position20>
    792         <Filename Value="WebServer/UHTTPServer.pas"/>
    793         <Caret Line="399" Column="18" TopLine="392"/>
     807        <Filename Value="Pages/UMainPage.pas"/>
     808        <Caret Line="333" Column="76" TopLine="313"/>
    794809      </Position20>
    795810      <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"/>
    798813      </Position21>
    799814      <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"/>
    802817      </Position22>
    803818      <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"/>
    806821      </Position23>
    807822      <Position24>
    808         <Filename Value="Application/UCustomApplication.pas"/>
    809         <Caret Line="95" Column="25" TopLine="83"/>
     823        <Filename Value="Application/UPageList.pas"/>
     824        <Caret Line="43" Column="62" TopLine="26"/>
    810825      </Position24>
    811826      <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"/>
    814829      </Position25>
    815830      <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"/>
    818833      </Position26>
    819834      <Position27>
    820         <Filename Value="Application/UCustomApplication.pas"/>
    821         <Caret Line="252" Column="6" TopLine="232"/>
     835        <Filename Value="Application/UPageList.pas"/>
     836        <Caret Line="20" Column="21" TopLine="1"/>
    822837      </Position27>
    823838      <Position28>
    824         <Filename Value="Application/UCustomApplication.pas"/>
    825         <Caret Line="31" Column="25" TopLine="18"/>
     839        <Filename Value="Application/UPageList.pas"/>
     840        <Caret Line="14" Column="24" TopLine="1"/>
    826841      </Position28>
    827842      <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"/>
    830845      </Position29>
    831846      <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"/>
    834849      </Position30>
    835850    </JumpHistory>
     
    841856    </Target>
    842857    <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"/>
    844859      <UnitOutputDirectory Value="bin"/>
    845860      <LCLWidgetType Value="gtk2"/>
  • trunk/CGI.lpr

    r35 r36  
    77  UMainPage, UCustomApplication, UUser, UHTTPSessionMySQL, UHTTPSessionFile,
    88  UCommon, UHTTPServer, UHTTPServerTCP, UHTTPServerCGI, UTCPServer, UPool,
    9   UMemoryStreamEx, UMIMEType;
     9  UMemoryStreamEx, UMIMEType, UPageList;
    1010
    1111var
     
    2525    RegisterPage('serverinfo', ServerInfo);
    2626    RegisterPage('kamery', WebCam);
     27    RegisterPage('uzivatel', UserControl);
    2728    RegisterPage('', About);
    2829    HTTPServer := THTTPServerCGI.Create;
  • trunk/Common/UHtmlClasses.pas

    r25 r36  
    140140    Scripts: TStringList;
    141141    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;
    142153    constructor Create;
    143154    destructor Destroy; override;
     
    560571end;
    561572
     573procedure TQueryString.SetStringServer;
     574begin
     575  //$this->SetString($_SERVER['QUERY_STRING']);
     576end;
     577
     578procedure TQueryString.SetString(QueryString: string);
     579begin
     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;*)
     591end;
     592
     593function TQueryString.GetString: string;
     594begin
     595  (*$Parts = array();
     596  foreach($this->Data as $Index => $Item)
     597  {
     598    $Parts[] = $Index.'='.$Item;
     599  }
     600  return(implode('&', $Parts));*)
     601end;
     602
     603constructor TQueryString.Create;
     604begin
     605  Data := TStringList.Create;
     606end;
     607
     608destructor TQueryString.Destroy;
     609begin
     610  Data.Free;
     611  inherited Destroy;
     612end;
     613
    562614end.
  • trunk/Pages/UMainPage.pas

    r35 r36  
    1919procedure ServerInfo(App: TCustomApplication; HandlerData: THTTPHandlerData);
    2020procedure WebCam(App: TCustomApplication; HandlerData: THTTPHandlerData);
     21procedure UserControl(App: TCustomApplication; HandlerData: THTTPHandlerData);
    2122
    2223implementation
     
    159160        '<br /><div align="center"><img name="theImage" src="" idth="640" height="480" alt="Webcam image"><br>Poslední aktualizace: ' +
    160161          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 />';
    162163      Text := Text + '</td></tr></table>';
    163164    end;
     
    316317    'Provozovatel: Ing. Jiří Hajda<br/>' +
    317318    'Adresa: Zděchov 208, 75607<br/>' +
    318     'Telefón: 737785792<br/>' +
     319    'Telefon: 737785792<br/>' +
    319320    '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/>' +
    320322    'IČ: 75904535<br/>' +
    321323    'DIČ: CZ8303255884<br/>' +
     
    324326end;
    325327
     328procedure UserControl(App: TCustomApplication; HandlerData: THTTPHandlerData);
     329var
     330  PageName: string;
     331begin
     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;
     342end;
     343
     344
    326345procedure ServerInfo(App: TCustomApplication; HandlerData: THTTPHandlerData);
    327346begin
  • trunk/WebServer/UHTTPSessionMySQL.pas

    r34 r36  
    6767  try
    6868    Lock.Acquire;
     69    DbRows := SqlDatabase.Query('DELETE FROM `HTTPSession` WHERE `Time` < DATE_SUB(NOW(), INTERVAL ' +
     70      IntToStr(Timeout) +' SECOND)');
     71    DbRows.Free;
    6972    DbRows := SqlDatabase.Query('SELECT * FROM `HTTPSession` WHERE `Identification`="' +
    7073      HandlerData.SessionId + '"');
     
    110113  Sessions := TStringList.Create;
    111114  SessionIdCookieName := 'SessionId';
    112   Timeout := 3600;
     115  Timeout := 3 * 3600;
    113116end;
    114117
Note: See TracChangeset for help on using the changeset viewer.