Jump to content

donlego

uniGUI Subscriber
  • Posts

    231
  • Joined

  • Last visited

Posts posted by donlego

  1. hello 

    i have unigui app with limiting the concurent login /access, when user session reached max limit my app will reject the login

    when use traditional unigui , it can handle when web server/server restart, then session list is become empty

    now i use hyper server unigui  ver 1506, and store the user session on database, user on close browser tab/close the browser delete the session store in database, but sometime (i dont know why there still session list left /undeleted)

    my question is

    1.why there sometime still session on the database left, i use delete session on database with this event

    • TUniMainModule.UniGUIMainModuleBrowserClose
    • TUniMainModule.UniGUIMainModuleDestroy
    • On Logout menu(user click the logout)
    • my delete function
      •  q.SQL.Text := 'DELETE FROM PENGGUNA_SESSION WHERE ID_SESSION=' +
                  QuotedStr(ID_SESSION) + '';

    2. what best method to clear database session when web server restart/server restart

    3.what best method can i use to clear left session every 5 minutes with session log time - current_time >5 hours, try use unithreadtimer on server module but no luck , it's never triger my function to   clear database session

  2. 1 minute ago, multimesut said:

    hi, you can fix it with mysql.

     

    
    MainModule;
    procedure TUniMainModule.UniGUIMainModuleCreate(Sender: TObject);
    begin
    MyQuery2.SQL.Clear;
    MyQuery2.SQL.Add('INSERT INTO sessions (sessionid,logindate) VALUES (:sessionid,:logindate)');
    MyQuery2.Params.ParamByName('sessionid').Value:=UniSession.SessionId;
    MyQuery2.Params.ParamByName('logindate').Value:=Now;
    MyQuery2.ExecSQL;
    end;
    
    procedure TUniMainModule.UniGUIMainModuleDestroy(Sender: TObject);
    begin
    MyQuery2.SQL.Clear;
    MyQuery2.SQL.Add('DELETE FROM sessions where sessionid=:sessionid');
    MyQuery2.Params.ParamByName('sessionid').Value:=UniSession.SessionId;
    MyQuery2.ExecSQL;
    end;
    
    SQL;
    DROP TABLE IF EXISTS `sessions`;
    CREATE TABLE `sessions`  (
      `sessionid` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
      `logindate` datetime(0) NULL DEFAULT NULL,
      `killsession` tinyint(1) NULL DEFAULT 0
    ) ENGINE = MEMORY CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Fixed;

     

    i was try with the method like that, but

    1.refresh the browser, the session id is changed, so  the ondestroy function not found the before refresh sessionid

    2. if the server reboot or failure then on server startup i must create other desktop service to clear all session on database

    • Like 1
  3. hello sherzod

    i create test case for you

    please check then unchek the checkbox column

    what i want is if the checkbox is checked=true then uniedit value= uniedit value+unidbgrid row value on valnya value

    else

    uniedit value= uniedit value-unidbgrid row value on valnya value

     

    for now i get always 2 , just check the first row checked column

     

    unigui_check_box.rar

×
×
  • Create New...