Jump to content

Hyperserver get all session list


donlego

Recommended Posts

  • 3 weeks later...
  • 2 weeks later...

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;

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 4 months later...
hi mhmda,
 can you explain to me, what you do if the web server restarts or the server restarts,
 do you create 1 small application to empty the session list in the database on the server statrtup or web server startup ?
 
 
 
  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...