🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.web
Article #1265

Re: AResponseInfo->Referer question

#1265
From: Remy Lebeau (TeamB)
Date: Tue, 05 Apr 2005 17:08
67 lines
3098 bytes
<Ulli> wrote in message news:opsorh16upgmwg2m@localhost...

> thanks. I knew there was some thing like that. But I couldn't
> remember.  Unfortunately the Values propertie is always empty
> the Names propertie is ok.

You are not using it properly.  The Values[] property expects a name as its
input parameter, not an index.

> The Tag is:
> <a href="Site_1.htm?light_1=Off">Light Off</a>

Use this instead:

    AnsiString value = ARequestInfo->Params->Values["light_1"];

With that said, if the URL is only going to have a single light at a time, I
would suggest you change your URL to something more like the following
instead:

    <a href="Site_1.htm?light=1&state=Off">Light Off</a>

Then you can do the following:

    AnsiString asLight = ARequestInfo->Params->Values["light"];
    AnsiString asState = ARequestInfo->Params->Values["state"];

    if( (asLight != "") && (asState != "") )
        // set the requested light to the specified state as needed...
    else
        // do something else...

If you don't do it this way, then you would have to loop through the Params
trying to parse them manually in order to find out which light is being
requested, ie:

    AnsiString asName, asValue;
    AnsiString asLight, asState;
    int iPos;

    for(int i = 0; i < ARequestInfo->Params->Count; ++i)
    {
        asName = ARequestInfo->Params->Strings[i];
        iPos = asName.Pos("=");
        if( iPos != 0 )
        {
            asValue = asName.SubString(iPos+1, MaxInt);
            asName.SetLength(iPos-1);
        }
        else
            asValue = "";

        if( AnsiSameText(asName.SubString(1, 6), "light_") )
        {
            asLight = asName.SubString(7, MaxInt);
            asState = asValue;
        }
    }

    if( (asLight != "") && (asState != "") )
        // set the requested light to the specified state as needed...
    else
        // do something else...


Gambit
Technical Details
Message-ID: <4252c5ba@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <opsoh67weogmwg2m@localhost> <424c50c6$1@newsgroups.borland.com> <opsojsglxqgmwg2m@localhost> <424d61f9@newsgroups.borland.com> <opsoo6ljd2gmwg2m@localhost> <4250f95a$1@newsgroups.borland.com> <opsoprskcvgmwg2m@localhost> <42517bb4$1@newsgroups.borland.com> <opsorh16upgmwg2m@localhost>

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,4b33aa1f27c59276
X-Google-Attributes: gidfeeec,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.web
References: <opsoh67weogmwg2m@localhost> <424c50c6$1@newsgroups.borland.com> <opsojsglxqgmwg2m@localhost> <424d61f9@newsgroups.borland.com> <opsoo6ljd2gmwg2m@localhost> <4250f95a$1@newsgroups.borland.com> <opsoprskcvgmwg2m@localhost> <42517bb4$1@newsgroups.borland.com> <opsorh16upgmwg2m@localhost>
Subject: Re: AResponseInfo->Referer question
Date: Tue, 5 Apr 2005 10:08:47 -0700
Lines: 69
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <4252c5ba@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1112720826 68.69.17.41 (5 Apr 2005 10:07:06 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail