You are here: $_SERVER['REQUEST_URI'] being trimmed « PHP « IT news, forums, messages
$_SERVER['REQUEST_URI'] being trimmed

Posted by Verdon Vaillancourt on 10/03/71 11:07

Hi :)

I am trying to build a simple mechanism to allow visitors to set a site
preference (stored in a cookie) by clicking on a link. I want the
cookie set and the original page reloaded with the new cookie set, when
a visitor clicks on the link.

My link looks like this...

<a href="/switch.php?userLangChoice=fr&amp;sender=<?php echo
$_SERVER['REQUEST_URI']; ?>">French</a>

My file switch.php looks like this...

<?php

setcookie("userLang", $userLangChoice);

if ($sender == "")
$sender = "index.php";
else
$sender = "$sender";

header("location:".$sender);

?>

Now, for the most part this works fine, but in some cases, my referring
URL ($sender) is being truncated. Simple URLs such as
'/listingsearch.php?Category%5B%5D=Hunting' work fine, although it is
being returned as '/listingsearch.php?Category[]=Hunting'. More complex
URLs like
'/listingsearch.php?
Accommodation%5B%5D=Outpost&Category%5B%5D=Fishing&Region%5B%5D=North-
West' are being truncated at the first variable down to
'/listingsearch.php?Accommodation[]=Outpost'

Is there something I can do to make sure the referring URL is not
truncated and it would also be nice if it was left alone and not
encoded or decoded.

Any thoughts? Thanks,
verdon

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация