Re: Session var read by form C++ CGI prog ?

From: Date: Tue, 02 Sep 2003 19:04:17 +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-161463@lists.php.net to get a copy of this message
Hello, If you use <input type='hidden'> yes they will be part of the input stream. What i suggested was you have <form method=post action="/cgi-bin/mycgi.exe?qid=123"> then you can retrieve the query string variable from the env. (at least this works with perl cgi and i don't see why it shouldn't work with C++ as well). the only draw back is that you have to process the qstring yourself. best regards raditha John Bryan wrote:
Thanks, very much, Raditha. Do you mean to pass my variable as a cgi parameter ? If so, the problem is that this file that is being uploaded via the form to the program MyCppProg.exe gets sent as THE input to the prog, apparently as a cgi-type parameter through stdin (i.e. cin), so that when I try to pass the value as a cgi parameter, it gets inserted INTO the file that is being uploaded. Am I understanding correctly, or did I miss the point ? Thanks, JB On Tuesday, September 02, 2003, at 01:21PM, Raditha Dissanayake <jabber@raditha.com> wrote:
Hi, Had a similar problem when building upload progress bar. Initially i used cookies but that had a few minor hiccups. What you can do is to encode your variables into the query string. This is accessible as part of the env. variables. Since you are familiar with C++ you will get the hang of PHP very quickly. oh and btw the correct way to set a cookie is with session_register(), $_SESSION is used for retrieval. John Bryan wrote:
I need to use something like a session variable to make a variable available to an existing form-invoked C++ program which takes as input a file being uploaded.  Is this even do-able ??    If so, what am I missing here ???
The C++ prog used to use the REMOTE_USER env var set by the web server but we are no longer doing authentication via the webserver itself, so this one does not get set, and I need to set something myself. The C++ prog would had been grabbing this by getenv("REMOTE_USER"). I was trying some php to set a session var 'UPATH' but the UPATH variable doesn't seem to be visible to MyCppProg.exe : --snip-- <?php $_SESSION['UPATH'] = 'foobar'; ?> <form enctype="multipart/form-data" action="MyCppProg.exe" method="post"> File to Upload: <input name="file" type="file"> <input type="submit" value="Send"> </form> --snip--
     
-- John Bryan johnbryan@mac.com http://homepage.mac.com/johnbryan http://homepage.mac.com/aijuan
-- http://www.raditha.com/php/progress.php A progress bar for PHP file uploads.

« previous php.general (#161463) next »