Solved

how do I read environment variable passed in C++

Posted on 2002-03-07
9
245 Views
Last Modified: 2010-04-01
I am trying trying to read the user name and password passed from a form in a web page in my c++ program.

Ho doea httpheader work in c++
0
Comment
Question by:yahya
9 Comments
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 6847112
Please give more details..
1. Which type of c++ program u r using ISAPI . or any type of dll ?
2. In which format u r getting the value, as a form , or a paramater list from a POST/GET ?

Roshmon
0
 

Author Comment

by:yahya
ID: 6847179
1. I am using  dll
2. as a form and as a parameter list POST

thankx
 
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 6847188
U getting the parameter list ?
And u want, just extract the user name & password ...

OR

U want to know how to get this parameter list

Roshmon
0
ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 

Author Comment

by:yahya
ID: 6847198
i want to know how to get it please
0
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 100 total points
ID: 6847214
I don't know this is suitable for u. I not, please excuse me.
My suggession is use a ISAPI dll. put that dll in Web server.

Or

U can use the Netscape SDK for plug-in from Nestace site. Then u can get the data from the client side.

GOOD LUCK
0
 

Author Comment

by:yahya
ID: 6847421
This q is changed now

I am getting the HTTP header however , when I extract the value I cant find the cookie header. any idea why.

I am using w2k and VC++ v6
 thanx
0
 
LVL 86

Expert Comment

by:jkr
ID: 6848342
See http://hoohoo.ncsa.uiuc.edu/cgi/env.html
as a reference.

The following example will render this data as HTML:

#include <stdio.h>
#include <strings.h>
#include <stdlib.h>

/* Compile:
   gcc  -Wall -pedantic -pipe -O5 -o user-data user-data.c
*/  

#include <stdio.h>
#include <strings.h>
#include <stdlib.h>

int main(void) {

char* pszUser = getenv ("REMOTE_USER"); // user name
char* pszAuth = getenv ("REMOTE_AUTH"); // auth info


  puts("Content-type: text/html\n");
  puts("<HTML><HEAD><TITLE>USER DATA</TITLE></HEAD>");
  puts("<CENTER><H1 ALIGN=CENTER> Here's your user data:</H1>%s %s<HR><H2>", pszUser, pszAuth);
  puts("</H2></BODY></HTML>");
}
0
 
LVL 11

Expert Comment

by:griessh
ID: 6955286
Dear yahya

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to split between

     "roshmon and jkr"

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 6979042
Force accepted.

jkr, I will post a separate question with points for your help.

** Mindphaser - Community Support Moderator **
0

Featured Post

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question