RE: Passing in and capturing userid
"Muizelaar, T.J. \(CTW\)" <[email protected]> Fri, 23 Sep 2005 11:56:10 +0200
| Newsgroups | gmane.comp.apache.mod-survey.general |
|---|---|
| Message-ID | <[email protected]> |
Thank you! It worked perfectly using REDIRECT="...../cgi-bin/test.cgi".
For anyone interested, the redirect script I developed (to be used in a
cgi-bin, or anywhere if .cgi is enabled in the apache configuration):
-------------------
#!/usr/bin/perl -Tw
use CGI qw/:standard/;
use CGI::Cookie;
use CGI::Carp qw(fatalsToBrowser);
%cookies = fetch CGI::Cookie;
$userid = $cookies{'userid'}->value;
print redirect("http://example.com/$userid");
--------------------
Thijs
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Joel
Palmius
Sent: woensdag 21 september 2005 23:38
To: [email protected]
Subject: RE: survey-discussion-list: Passing in and capturing userid
A bit more tricky, but not impossible. You can set a cookie from within
a perl snippet. If you direct to a script, that script can read the
cookie and then re-direct to the personal home page.
The cookie setting has to be done in a submit-time snippet, something
like in the last page
<SURVEY .. CONTINUE="myforwardscript.cgi">
<SUBMIT VISIBLE="no">
{|
$userid = $session->getValue("SUBMITTED_userid");
$self->SetCookie("userid",$userid);
|}
</SUBMIT>
</SURVEY>
Reading this it strikes me that you could probably set VISIBLE="yes" and
print a complete HTML page with a <META REFRESH ...> tag that forwards
immediately instead of going via an external script. I haven't tested
either solution though.
// Joel
On Wed, 21 Sep 2005, Muizelaar, T.J. (CTW) wrote:
> Hi all,
>
> The solution below works fine for capturing an userid. I've been
> trying to use the same userid for a redirect after submitting the
survey.
>
> Basically, what I have is people entering the survey with an url of:
> ....?action=display&userid=xxxxxxx
>
> When they finish the survey, they have to be routed back to a personal
> website, based on the same userid. This means that the CONTINUE
> parameter should be something like: http://example.com/page_of_xxxxxxx
>
> I tried using {$userid$} but that did not work. Has someone an idea
> how to provide a personal redirect?
>
> Sincerely,
>
>
> Thijs Muizelaar
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Joel
> Palmius
> Sent: vrijdag 12 augustus 2005 8:47
> To: [email protected]
> Subject: Re: survey-discussion-list: Passing in and capturing userid
>
> Hello, sorry this answer took a while.
>
> This scenario has usually been addressed through the use of perl
> snippets.
> These have access to the argument line, ie the GET url.
>
> <SURVEY TITLE="argument">
>
> <TEXT NAME="test" CAPTION="test" />
>
> <CUSTOM ESCAPED="no" VARIABLES="userid">
> <input type="hidden" name="userid" value="{\
> print $argument->ArgByName("userid") || "unknown";
> \}" />
> </CUSTOM>
>
> </SURVEY>
>
> You call this through, for example:
>
>
> http//127.0.0.1/mod_survey/argument.survey?action=display&userid=joepa
> l
>
> The action=display is important since you'll get an argument error
> otherwise.
>
> // Joel
>
> On Wed, 10 Aug 2005, Paul Rosenberg wrote:
>
>> Hi,
>>
>> When a survey is invoked via a link from an email message I want to
>> be
>
>> able to get hold of respondent-specific values such as "userid" I
>> don't mind passing these in to the survey via the KEYWORDS parameter
>> or similar. The idea is to pass such a value through to the
>> respondent's results via a hidden INPUT. That latter stage is
> documented of course.
>>
>> Any help appreciated.
>>
>> Best wishes,
>> Paul Rosenberg
>>
>> Frontwire Ltd
>> UK
>>
>> Tel: +44 (0)845 644 4365
>>
>> Skickat av Paul Rosenberg <[email protected]> till survey-discussion
>>
> Skickat av Joel Palmius <[email protected]> till survey-discussion
>
> Skickat av "Muizelaar, T.J. \(CTW\)" <[email protected]>
> till survey-discussion
>
Skickat av Joel Palmius <[email protected]> till survey-discussion
Skickat av "Muizelaar, T.J. \(CTW\)" <[email protected]>
till survey-discussion