Skip to content

Commit 876de16

Browse files
authored
Update README.md
Correct removal of queueittoken (for redirect usage) in examples
1 parent 15c595f commit 876de16

File tree

1 file changed

+28
-19
lines changed

1 file changed

+28
-19
lines changed

README.md

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,12 @@ $queueittoken = isset( $_GET["queueittoken"] )? $_GET["queueittoken"] :'';
6868

6969
try
7070
{
71+
$fullUrl = getFullRequestUri();
72+
$currentUrlWithoutQueueitToken = preg_replace("/([\\?&])("."queueittoken"."=[^&]*)/i", "", $fullUrl);
73+
7174
//Verify if the user has been through the queue
72-
$result = QueueIT\KnownUserV3\SDK\KnownUser::validateRequestByIntegrationConfig(getFullRequestUri(),
73-
$queueittoken, $configText, $customerID, $secretKey);
75+
$result = QueueIT\KnownUserV3\SDK\KnownUser::validateRequestByIntegrationConfig(
76+
$currentUrlWithoutQueueitToken, $queueittoken, $configText, $customerID, $secretKey);
7477

7578
if($result->doRedirect())
7679
{
@@ -85,10 +88,10 @@ try
8588
die();
8689
}
8790
if(!empty($queueittoken))
88-
{
89-
//Request can continue - we remove queueittoken from querystring parameter to avoid sharing of user specific token
90-
header('Location: '.str_replace("?queueittoken=".$queueittoken,"", getFullRequestUri()));
91-
die();
91+
{
92+
//Request can continue - we remove queueittoken form querystring parameter to avoid sharing of user specific token
93+
header('Location: ' . $currentUrlWithoutQueueitToken);
94+
die();
9295
}
9396
}
9497
catch(\Exception $e)
@@ -152,9 +155,12 @@ $queueittoken = isset( $_GET["queueittoken"] )? $_GET["queueittoken"] :'';
152155

153156
try
154157
{
158+
$fullUrl = getFullRequestUri();
159+
$currentUrlWithoutQueueitToken = preg_replace("/([\\?&])("."queueittoken"."=[^&]*)/i", "", $fullUrl);
160+
155161
//Verify if the user has been through the queue
156-
$result = QueueIT\KnownUserV3\SDK\KnownUser::resolveRequestByLocalEventConfig(getFullRequestUri(),
157-
$queueittoken, $eventConfig, $customerID, $secretKey);
162+
$result = QueueIT\KnownUserV3\SDK\KnownUser::resolveRequestByLocalEventConfig(
163+
$currentUrlWithoutQueueitToken, $queueittoken, $eventConfig, $customerID, $secretKey);
158164

159165
if($result->doRedirect())
160166
{
@@ -168,10 +174,10 @@ try
168174
die();
169175
}
170176
if(!empty($queueittoken))
171-
{
172-
//Request can continue - we remove queueittoken from querystring parameter to avoid sharing of user specific token
173-
header('Location: '.str_replace("?queueittoken=".$queueittoken,"", getFullRequestUri()));
174-
die();
177+
{
178+
//Request can continue - we remove queueittoken form querystring parameter to avoid sharing of user specific token
179+
header('Location: ' . $currentUrlWithoutQueueitToken);
180+
die();
175181
}
176182
}
177183
catch(\Exception $e)
@@ -208,9 +214,12 @@ $queueittoken = isset( $_GET["queueittoken"] )? $_GET["queueittoken"] :'';
208214

209215
try
210216
{
217+
$fullUrl = getFullRequestUri();
218+
$currentUrlWithoutQueueitToken = preg_replace("/([\\?&])("."queueittoken"."=[^&]*)/i", "", $fullUrl);
219+
211220
//Verify if the user has been through the queue
212-
$result = QueueIT\KnownUserV3\SDK\KnownUser::validateRequestByIntegrationConfig(getFullRequestUri(),
213-
$queueittoken, $configText, $customerID, $secretKey);
221+
$result = QueueIT\KnownUserV3\SDK\KnownUser::validateRequestByIntegrationConfig(
222+
$currentUrlWithoutQueueitToken, $queueittoken, $configText, $customerID, $secretKey);
214223

215224
if($result->doRedirect())
216225
{
@@ -234,14 +243,14 @@ try
234243
die();
235244
}
236245
if(!empty($queueittoken) && !empty($result->actionType))
237-
{
238-
//Request can continue - we remove queueittoken from querystring parameter to avoid sharing of user specific token
239-
header('Location: '.str_replace("?queueittoken=".$queueittoken,"", getFullRequestUri()));
240-
die();
246+
{
247+
//Request can continue - we remove queueittoken form querystring parameter to avoid sharing of user specific token
248+
header('Location: ' . $currentUrlWithoutQueueitToken);
249+
die();
241250
}
242251
}
243252
catch(\Exception $e)
244253
{
245254
//log the exception
246255
}
247-
```
256+
```

0 commit comments

Comments
 (0)