Solved

how do I read environment variable passed in C++

Posted on 2002-03-07
9
236 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
 

Author Comment

by:yahya
ID: 6847198
i want to know how to get it please
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
cb: unreferenced local variable 11 72
C Language combined operators 28 106
GUI: DIalog Stacking and Popping in MS C++ 4 65
Exception thrown at 0x00007FFD5BC81F28 7 38
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
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 additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

911 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now