From aa83ac633e2275bbdb3d1eeadb6a17c9caedb1f2 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Mon, 23 Mar 2015 15:52:10 +0000 Subject: [PATCH] routeSQL : incorrect cookie used when search in a page and go in a chained page : the chained page use the cookie without need ! git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2062 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- routeSQL.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/routeSQL.php b/routeSQL.php index 970d0d8..2e13f1c 100644 --- a/routeSQL.php +++ b/routeSQL.php @@ -615,12 +615,17 @@ class routeSQL $this->chained->editright ($this->authHTML["email"], $chain) !== true) $this->readwriteAllowed = false; + $this->url_prefix = str_replace ("{chain}", $chain, $this->url_prefix); + $cookiePrefix = rawurlencode ($this->url_prefix); + if (isset ($_COOKIE["$cookiePrefix-num"])) + $num = $_COOKIE["$cookiePrefix-num"]; + if (isset ($_COOKIE["$cookiePrefix-page"])) + $page = $_COOKIE["$cookiePrefix-page"]; + if (isset ($_COOKIE["$cookiePrefix-search"])) + $search = $_COOKIE["$cookiePrefix-search"]; // num is the number of elements displayed by page // page is the page to display // Allow the parameters to be sent in any order - if (isset ($_COOKIE["num"])) $num = $_COOKIE["num"]; - if (isset ($_COOKIE["page"])) $page = $_COOKIE["page"]; - if (isset ($_COOKIE["search"])) $search = $_COOKIE["search"]; if ($p1 === "num") $num = $v1; if ($p2 === "num") $num = $v2; if ($p3 === "num") $num = $v3; @@ -636,10 +641,10 @@ class routeSQL $page = intval ($page); $num = intval ($num); $search = rawurldecode ($search); - setcookie ("page", $page, time()+3600*24*30, $this->path); - setcookie ("num", $num, time()+3600*24*30, $this->path); - setcookie ("search", $search, time()+3600*24*30, $this->path); - $this->url_prefix = str_replace ("{chain}", $chain, $this->url_prefix); + setcookie ("$cookiePrefix-page", $page, time()+3600*24*30, $this->path); + setcookie ("$cookiePrefix-num", $num, time()+3600*24*30, $this->path); + setcookie ("$cookiePrefix-search", $search, time()+3600*24*30, + $this->path); //echo "PAGE=$page\n"; //echo "NUM=$num\n"; //echo "SEARCH=$search\n";