Solved

how do I read environment variable passed in C++

Posted on 2002-03-07
9
264 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

696 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