note 72829 added to language.variables.predefined
| From: | holger at doessing dot net | Date: | Fri, 02 Feb 2007 14:07:18 +0000 |
| Subject: | note 72829 added to language.variables.predefined | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-122558@lists.php.net to get a copy of this message | ||
On the subject of permalinks and queries:
Say, you use an inexpensive subdomain of (e.g.) www.nice.net, thus www.very.nice.net, and that the
domain owner has simply placed a frame at this particular location, linking to the actual address
(ugly and subject-to-change) of your site.
Consequently, the actual site URI and various associated hashes and query strings are not
immediately visible to the user. Sometimes this is useful, but it also makes
bookmarking/permalinking impossible (the browser will only bookmark the static address in the top
frame).
However, as far as the query strings go, there is workaround. Instead of providing users with
permalinks to the actual URI (e.g. prtcl://weird.and.ugly/~very/ugly.php?stuff=here; may even be
subject to change), I provide them with this: prtcl://www.very.nice.net?stuff=here.
In brief, I then use the following code to re-populate the $_GET array:
if (isset($_SERVER['HTTP_REFERER'])) { // If set, this page is running in a frame
$uri = parse_url($_SERVER['HTTP_REFERER']); // grab URI of parent frame
$querystring = ($uri['query']) ? $uri['query'] : false; // grab the querystring
if ($querystring) {
$vars = explode('&', $querystring); // cut into individual statements
foreach ($vars as $varstring) { // populate $_GET
$var = explode('=', $varstring);
if (count($var) == 2) $_GET[$var[0]] = $var[1];
}
} // no, nothing to report from the parent frame
} // no, not using a parent frame today...
If the actual host address is ever changed, users entering the frame (with the nicer address) will
be using the new (and ugly) URI, but this way the old query strings will be available to the new
address also. The users will never again be bothered by you moving to another neighborhood.
----
Server IP: 195.184.96.15
Probable Submitter: 130.226.173.20
----
Manual Page -- http://www.php.net/manual/en/language.variables.predefined.php
Edit -- https://master.php.net/note/edit/72829
Del: integrated -- https://master.php.net/note/delete/72829/integrated
Del: useless -- https://master.php.net/note/delete/72829/useless
Del: bad code -- https://master.php.net/note/delete/72829/bad+code
Del: spam -- https://master.php.net/note/delete/72829/spam
Del: non-english -- https://master.php.net/note/delete/72829/non-english
Del: in docs -- https://master.php.net/note/delete/72829/in+docs
Del: other reasons-- https://master.php.net/note/delete/72829
Reject -- https://master.php.net/note/reject/72829
Search -- https://master.php.net/manage/user-notes.php