Re: ?=something
| From: | Mike Eheler | Date: | Wed, 17 Oct 2001 17:34:35 +0000 |
| Subject: | Re: ?=something | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-71362@lists.php.net to get a copy of this message | ||
Here's a script that can let you test for all these kind of things and
see what exactly they can do for you:
<html>
<head><title></title></head>
<body>
<pre>
<?php
ob_start();
print_r(get_defined_vars());
$text = ob_get_contents();
ob_end_clean();
echo htmlspecialchars($text);
?>
</pre>
</body></html>
When you save this as a file, i.e. dumpvars.php, then call it with that
parameter:
http://www.somedomain.com/dumpvars.php?yes
You will see that the PHP globally defined argv array has in it :
[argv] => Array
(
[0] => yes
)
So you can do whatever you want with that value, and it's easy to test for.
Also, if you have register_globals set to Off, then you can access the
argv array as $HTTP_SERVER_VARS['argv'], something like this:
$argv = $HTTP_SERVER_VARS['argv'];
if (count($argv) > 0) {
foreach ($argv as $key => $value) {
if (is_numeric($key)) {
switch ($value) {
case "yes":
// do stuff
break;
}
}
}
}
Mike Eheler
Alex Shi wrote:
>Well I know my question is deinately biased from this list, but your
>question do recall me something: one time I even saw a url like this:
>http://www.myweb.com/mypage.html?yes
>
>How could a parameter be passed to a .html, and how could a value be
>passed without a name?
>
>----- Original Message -----
>From: "Kacey A. Murphy" <murphster47@hotmail.com>
>To: <php-general@lists.php.net>
>Sent: Wednesday, October 17, 2001 3:07 AM
>Subject: [PHP] ?=something
>
>
>>I have noticed some sites have a great way of putting there links to urls,
>>
>I
>
>>always just put the normal link such as url=products.php is there a way to
>>make a list of all the urls and direct them to like say they click on
>>DOWNLOADS the url that will show on the url screen would be
>>http://myweb.com/=?downloads but it is really going to
>>http://myweb.com/downloads.php
>>
>>does that make sense??? I hope. Thanks
>>
>>
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
>>For additional commands, e-mail: php-general-help@lists.php.net
>>To contact the list administrators, e-mail: php-list-admin@lists.php.net
>>
>>
>
>