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

2003-09-02 Thread John Bryan
 
On Tuesday, September 02, 2003, at 05:12PM, Chris Shiflett <[EMAIL PROTECTED]> wrote:

>--- John Bryan <[EMAIL PROTECTED]> wrote:
>> So looks like I can't have it both ways, i.e. POST and GET
>
>Yes, you can.
>
>
>
>
>
>The script blah.php can reference $_GET['foo'] and $_POST['bar']. The values of
>these variables will be 1 and 2, respectively.
>

Thanks, Chris.  That's pretty cool.  I wish I had time to rewrite this dang cpp prog 
in php or something that better lends itself to these things.  

>Please keep in mind that this is a PHP list...
>

Will do.  Was/am thinking I could use php to set 'session' variable(s) that would also 
be visible to an existing cpp prog currently invoked from a form.

 j b

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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

2003-09-02 Thread John Bryan
 
On Tuesday, September 02, 2003, at 02:04PM, Raditha Dissanayake <[EMAIL PROTECTED]> 
wrote:

>Hello,
>If you use  yes they will be part of the input 
>stream. What i suggested was you have
> 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.
>

Actually, upon further reading it seems I won't be able to do this.

If I pass parameters in this fashion, the web server will make them available in 
QUERY_STRING, but I need to use the GET method.  

The form is using the POST method so that the file that is being uploaded and 
processed gets handed to the cgi program through stdin.

So looks like I can't have it both ways, i.e. POST and GET, stdin and query string env 
var.

Thanks,
JB

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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

2003-09-02 Thread John Bryan
 
On Tuesday, September 02, 2003, at 01:55PM, CPT John W. Holmes <[EMAIL PROTECTED]> 
wrote:

>From: "John Bryan" <[EMAIL PROTECTED]>
>
>> 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.
>
>Does this file already exist or are you looking to create it? It sounds like
>you just need to fopen() the file, tack on your "variable" at the end of the
>file (in some format) and then let the C++ program load the file, right?
>
>---John Holmes...

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.

thanks,
jb

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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

2003-09-02 Thread John Bryan
 
On Tuesday, September 02, 2003, at 02:04PM, Raditha Dissanayake <[EMAIL PROTECTED]> 
wrote:

>Hello,
>If you use  yes they will be part of the input 
>stream. What i suggested was you have
> 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.
>


Right.  That is what I had tried before, using it as a hidden parameter.  I will try 
passing as part of the explicit call to the prog as you describe.

thanks,
jb

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Session var read by form C++ CGI prog ?

2003-09-02 Thread John Bryan
 
On Tuesday, September 02, 2003, at 01:32PM, Ford, Mike [LSS] <[EMAIL PROTECTED]> wrote:

>On 02 September 2003 19:22, Raditha Dissanayake 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.
>
>Er, nope.  If you have a version of PHP with the $_SESSION array, then you use it for 
>both setting *and* retrieving -- session_register() and friends should *not* be used 
>in this case.  (Indeed, there are circumstances where the combination of 
>session_register() with $_SESSION gives broken behaviour.)
>

Right. I am running PHP 4.3.3.  Win32 version to be specific, on Win2k server, with 
Apache 1.3.26.  I installed PHP to try and do this trick.

JB

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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

2003-09-02 Thread John Bryan
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 <[EMAIL PROTECTED]> 
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--
>>
>>>$_SESSION['UPATH'] = 'foobar';
>>?>
>>
>>
>>  File to Upload:  
>>
>>
>>--snip--

 

--
John Bryan
[EMAIL PROTECTED]
http://homepage.mac.com/johnbryan
http://homepage.mac.com/aijuan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Session var read by form C++ CGI prog ?

2003-09-02 Thread John Bryan

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--




  File to Upload:  


--snip--

I am new to php, have been digging around on the web, and not making a lot of headway 
quickly enough, so I'm asking.

Thanks,
JB

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php