Re: Session var read by form C++ CGI prog ?
| From: | CPT John W. Holmes | Date: | Tue, 02 Sep 2003 20:16:53 +0000 |
| Subject: | Re: Session var read by form C++ CGI prog ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-161476@lists.php.net to get a copy of this message | ||
From: "John Bryan" <johnbryan@mac.com>
> The file would already exist on the client side. They are
> uploading the file to be processed by this program
> MyCppProg.exe, which is invoked as a form 'action'.
> This already works, but depends on the Apache variable
> REMOTE_USER being set when user logs in, but we
> moving to implement a different method for authentication
> that involves talking to two different Oracle databases,
> password rules, etc., so this REMOTE_USER variable
> no longer gets set since we are bypassing Apache's
> authentication here.
>
> So I need to set an 'environment' variable that remains
> visible to scripts and progs within the session space, that
> can then be grabbed by the MyCppProg.exe, for example
> with getenv("MyEnvVar"). It used to use getenv("REMOTE_USER").
>
> I'm hoping to not have this variable have to be part of the file that gets
uploaded.
Ah, I see now.
If you're using a file upload box and submitting that form directly to your
.exe, then there's probably not much you can do.
In order to do this, I think you'll have to "intercept" the file.
When the user submits the file, it goes to a PHP script that copies it
somewhere. Then see if you can make an exec() call to the system and set the
"REMOTE_USER" variable, somehow. I'm not sure on the syntax/possibility of
that, it would depend upon your OS. Then make another exec() call to your
C++ program and send it the path the the file that was already uploaded.
Capture the output and show it to the user or do whatever you normally do.
---John Holmes...