Re: header("Location:") with POST-data
| From: | Michael Dearman | Date: | Fri, 15 Dec 2000 14:39:02 +0000 |
| Subject: | Re: header("Location:") with POST-data | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-30500@lists.php.net to get a copy of this message | ||
mailing_list@gmx.at wrote:
>
> It is possible to do a redirect like:
> header("Location: /script.php?X=1&Y=2\n");
>
> but is this possible with POST and not GET-data, so the user wouldn't see
> the Get-Variables in the URL???
>
Would certainly like to hear any other solutions. And thanks Matthew, I've
yet to use session variables, but maybe it's time to take a look.
Here's our, probably naive, attempt at resolving this issue.
1. Use the ErrorDocument 404 /intercept.php trick in either the
httpd.conf or .htaccess to force url's to non-existent files (such as book.html)
to the processing script. Break off the extension and stick .php or whatever on
the file name. Check if the file exists, process the file or 'include' an
'error_msg.inc'.
2. For encoded variables, use a regexp to check for intercept.php?. If so, capture
the remainder of the url to attach to a desired file - using the header()
So: in an .htaccess file or...
if (...check for some standard means of using fake .html files or whatever) {
check for existance of $file.inc, and include some file that makes sense
} elseif (preg_match('/intercept\.php\?(.+)/', $REQUEST_URI, $arr)) {
header("location: /action.php?$arr[1]");
} else {
include "error_msg.html"
}
Any suggestions for improvement on this?
Mike D.