diff --git a/lib/controller/opMobileFrontWebController.class.php b/lib/controller/opMobileFrontWebController.class.php index 994d41d..2d0e873 100644 --- a/lib/controller/opMobileFrontWebController.class.php +++ b/lib/controller/opMobileFrontWebController.class.php @@ -53,10 +53,19 @@ class opMobileFrontWebController extends opFrontWebController $url = substr($url, 0, $fragPos); } - if (strpos($url, '?') === false) + $endPos = strlen($url) - 1; + $qPos = strrpos($url, '?'); + $aPos = strrpos($url, '&'); + if ($qPos === false) { $url .= '?'; } + // When URL string does not terminate in a question mark and the ampersand, and a question mark is not included. + elseif ($qPos !== false && $qPos !== $endPos && $aPos !== $endPos) + { + $url .= '&'; + } + $url .= SID.$fragment; } @@ -78,7 +87,7 @@ class opMobileFrontWebController extends opFrontWebController if (!$this->context->getRequest()->isCookie()) { - $matchd = '/'.preg_quote(session_name(),'/').'=.*([&|#]?)/'; + $matchd = '/'.preg_quote(session_name(),'/').'=[^&#]*([&#]?)/'; if (preg_match($matchd, $url)) { $url = preg_replace($matchd, SID.'\1', $url);