From 372fd6b61c20b6859d8ba542034708f0c30aeb01 Mon Sep 17 00:00:00 2001 From: Matteo Nastasi Date: Sun, 19 Apr 2020 11:09:15 +0200 Subject: [PATCH] introduced 'page_id' in index.php --- TODO.txt | 8 ++++++++ web/Obj/user.phh | 7 ++++++- web/index.php | 8 ++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/TODO.txt b/TODO.txt index 9e88cb7..a7aa3be 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,6 +1,14 @@ TODO | ------+ +page_id => + - add page_id to both index.php pages (WIP) + DONE - add page_id to user class + - pass page_id to transport (WIP) + - manage index_rd + - manage page to stop transport retry + + BUGS | ------+ - manage client answer (ping) on closing ws diff --git a/web/Obj/user.phh b/web/Obj/user.phh index 32bb71e..6335832 100644 --- a/web/Obj/user.phh +++ b/web/Obj/user.phh @@ -112,6 +112,7 @@ class User { var $code; // authentication code var $name; // name of the user var $sess; // session of the user + var $page_id; // id of the latest page connected with this session var $ip; // ip of the user var $lacc; // last access (for the cleanup) var $laccwr; // last access (for the cleanup) @@ -167,7 +168,7 @@ class User { function User() { } - static function create(&$brisk, $idx, $name, $sess, $stat = "", $subst = "", $table = -1, $ip="0.0.0.0") { + static function create(&$brisk, $idx, $name, $sess, $page_id="", $stat = "", $subst = "", $table = -1, $ip="0.0.0.0") { if (($thiz = new User()) == FALSE) return (FALSE); @@ -177,6 +178,7 @@ class User { $thiz->code = -1; $thiz->name = $name; $thiz->sess = $sess; + $thiz->page_id = $page_id; $thiz->ip = $ip; $thiz->lacc = time(); $thiz->laccwr = time(); @@ -233,6 +235,7 @@ class User { $this->code = $from->code; $this->name = $from->name; $this->sess = $from->sess; + $this->page_id = $from->page_id; $this->ip = $from->ip; $this->lacc = $from->lacc; $this->laccwr = $from->laccwr; @@ -299,6 +302,7 @@ class User { $thiz->code = $from->code; $thiz->name = $from->name; $thiz->sess = $from->sess; + $thiz->page_id = $from->page_id; $thiz->ip = $from->ip; $thiz->lacc = $from->lacc; $thiz->laccwr = $from->laccwr; @@ -578,6 +582,7 @@ class User { $tmp_sess = $this->sess; $this->sess = ""; + $this->page_id = ""; self::unproxy_step($tmp_sess); $this->name = ""; // OK here while (array_pop($this->comm) != NULL); diff --git a/web/index.php b/web/index.php index eb49939..66ccd64 100644 --- a/web/index.php +++ b/web/index.php @@ -512,6 +512,13 @@ function index_main(&$brisk, $transp_type, $header, &$header_out, $remote_addr_f } } } + + if ($ACTION == "room") { + /* shutdown any previous transport socket */ + $user->page_id = md5(microtime().$remote_addr_full); + // $brisk->abort_old_sockets($user); + } + /* Rendering. */ if ($BRISK_SHOWHTML == "debugtable") { @@ -1052,6 +1059,7 @@ supported by:
var $$ = jQuery.noConflict(); var myname = null; +var page_id = "<$ echo $user->page_id; ?>"; var g_debug = 0; var g_lang = ""; var g_lng = ""; -- 2.17.1