Click here to get back home

Hiding variables passed via URL

 HomeNewsGroups | Search | About
 comp.lang.php    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Hiding variables passed via URL chochote 07-12-2008
Get Chitika Premium
Posted by chochote on July 12, 2008, 11:44 am
Please log in for more thread options
Hi,

I have a PHP script that does some processing, and stores an error
message as a variable. The script then redirects to another script
with the error string in the URL, with the second script displaying
the message and continues with the rest of the logic.

Now I want to hide the error message from the URL, but the second
script needs to continue working as is. How can I do this? I have
thought about md5'ing the message but the URLs still look messy. Any
other alternatives?

The script works like this;
$err = "";
$res = process();
if ($res == 0)
{
$err = "An error message";
}
header("Location: script2.php?err=".urlencode($err));

Script2.php would display this message and continue with the rest of
the logic. Now I want to hide the Error message $err from the URL
after a redirect. How do I do this?

Thanks in advance.

Posted by Olaf Schinkel on July 12, 2008, 1:10 pm
Please log in for more thread options
chochote@gmail.com schrieb:
> Hi,
>
> I have a PHP script that does some processing, and stores an error
> message as a variable. The script then redirects to another script
> with the error string in the URL, with the second script displaying
> the message and continues with the rest of the logic.
>
> Now I want to hide the error message from the URL, but the second
> script needs to continue working as is. How can I do this? I have
> thought about md5'ing the message but the URLs still look messy. Any
> other alternatives?
>
> The script works like this;
> $err = "";
> $res = process();
> if ($res == 0)
> {
> $err = "An error message";
> }
> header("Location: script2.php?err=".urlencode($err));
>
> Script2.php would display this message and continue with the rest of
> the logic. Now I want to hide the Error message $err from the URL
> after a redirect. How do I do this?
>
> Thanks in advance.
SESSION varaibles exist.


Posted by The Natural Philosopher on July 12, 2008, 1:42 pm
Please log in for more thread options
chochote@gmail.com wrote:
> Hi,
>
> I have a PHP script that does some processing, and stores an error
> message as a variable. The script then redirects to another script
> with the error string in the URL, with the second script displaying
> the message and continues with the rest of the logic.
>
> Now I want to hide the error message from the URL, but the second
> script needs to continue working as is. How can I do this? I have
> thought about md5'ing the message but the URLs still look messy. Any
> other alternatives?
>
> The script works like this;
> $err = "";
> $res = process();
> if ($res == 0)
> {
> $err = "An error message";
> }
> header("Location: script2.php?err=".urlencode($err));
>
> Script2.php would display this message and continue with the rest of
> the logic. Now I want to hide the Error message $err from the URL
> after a redirect. How do I do this?
>
> Thanks in advance.
Use POST method.

Declare a form, and set a hidden variable err

Posted by Michael Fesser on July 12, 2008, 3:13 pm
Please log in for more thread options
.oO(The Natural Philosopher)

>chochote@gmail.com wrote:
>> Hi,
>>
>> I have a PHP script that does some processing, and stores an error
>> message as a variable. The script then redirects to another script
>> with the error string in the URL, with the second script displaying
>> the message and continues with the rest of the logic.
>>
>> Now I want to hide the error message from the URL, but the second
>> script needs to continue working as is. How can I do this? I have
>> thought about md5'ing the message but the URLs still look messy. Any
>> other alternatives?
>>
>> The script works like this;
>> $err = "";
>> $res = process();
>> if ($res == 0)
>> {
>> $err = "An error message";
>> }
>> header("Location: script2.php?err=".urlencode($err));
>>
>> Script2.php would display this message and continue with the rest of
>> the logic. Now I want to hide the Error message $err from the URL
>> after a redirect. How do I do this?
>>
>> Thanks in advance.
>
>Use POST method.
>
>Declare a form, and set a hidden variable err

You can't redirect a POST request. Sessions are the way to go here if
the error code shouldn't appear in the URL.

Micha

Posted by The Natural Philosopher on July 12, 2008, 4:57 pm
Please log in for more thread options
Michael Fesser wrote:
> .oO(The Natural Philosopher)
>
>> chochote@gmail.com wrote:
>>> Hi,
>>>
>>> I have a PHP script that does some processing, and stores an error
>>> message as a variable. The script then redirects to another script
>>> with the error string in the URL, with the second script displaying
>>> the message and continues with the rest of the logic.
>>>
>>> Now I want to hide the error message from the URL, but the second
>>> script needs to continue working as is. How can I do this? I have
>>> thought about md5'ing the message but the URLs still look messy. Any
>>> other alternatives?
>>>
>>> The script works like this;
>>> $err = "";
>>> $res = process();
>>> if ($res == 0)
>>> {
>>> $err = "An error message";
>>> }
>>> header("Location: script2.php?err=".urlencode($err));
>>>
>>> Script2.php would display this message and continue with the rest of
>>> the logic. Now I want to hide the Error message $err from the URL
>>> after a redirect. How do I do this?
>>>
>>> Thanks in advance.
>> Use POST method.
>>
>> Declare a form, and set a hidden variable err
>
> You can't redirect a POST request.

Are you sure?

>Sessions are the way to go here if
> the error code shouldn't appear in the URL.
>
> Micha

Similar ThreadsPosted
Re: Hiding variables passed via URL July 14, 2008, 4:39 pm
Yet another request for a URL variables hiding suggestion June 6, 2005, 4:15 am
Getting the names of variables passed to functions October 10, 2007, 8:00 am
URL hiding ... December 2, 2004, 1:25 am
Hiding download link October 17, 2005, 4:08 pm
calling image November 28, 2005, 5:38 am
Hiding database connection info January 18, 2006, 11:41 am
hiding / replace To: email addresses ... September 25, 2006, 6:26 am
Newbie PHP question: 'hiding' code on server from View Source January 16, 2007, 11:49 am
XML being passed to PHP via POST October 11, 2004, 9:26 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap