note 1143 deleted from function.getenv by thiago
| From: | thiago@php.net | Date: | Thu, 13 Nov 2008 16:12:34 +0000 |
| Subject: | note 1143 deleted from function.getenv by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-146501@lists.php.net to get a copy of this message | ||
Note Submitter: sorry at spammed dot nut
----
To show a use of getenv("QUERY_STRING")....
suppose you have a site with frames... the frames create the "interface", and one frame
called "main" has an active document... now, suppose you made a page.php3 which took an
argument "pg" and spit out the framesets necessary, with "main" frame containing
whatever "pg" is... so now you can bring up any page in your site with
page.php3?pg=test.html
now, take this one step further, and suppose you want outside links to point to php3 pages which
takes parameters, ON your site... but you still want them to appear in frames, so what do you do?
well, if "ok.php3" was the page you wanted to show, and it was requested as
"ok.php3?some=params&go=here", then the very thing in the beginning of ok.php3 could
be :
<?php
if (!isset($inframe)) {
header("Location: http://yoursite/page.php3?pg=".urlencode("inframes=1&").getenv("QUERY_STRING"));
exit;
}
?>
Now... you might ask, how in the world did I come up with THAT? Well, perhaps it was because I came
here not able to remember which environment variable held the query string...