Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

How do you pass session id to another Perl Script

Quote Reply
How do you pass session id to another Perl Script
Hello,
I am using a free perl script "contactus.pl" to handle the contact us form inside the contact_us.html page that is built using pagebuilder mod in dynamic mode.
I am using sessions. But when user clicks on contact_us.html page, he/she still sees the session id: "s=lkjl3k5kj2kjhh4243jklh23" in the URL; however, when he/she submits the form, the confirmation page/error page loses the session from the URL.
My question, how can I pass the session to the contactus.pl so the user does not need to login again when he/she submit the form?
Thanks
Mark
Quote Reply
Re: [Mark2] How do you pass session id to another Perl Script In reply to
Have you considered using cookie sessions?
It's much easy to handle it ;)

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
Quote Reply
Re: [eupos] How do you pass session id to another Perl Script In reply to
Not really... as I think the session is more secured and some people may have cookies disabled.. so I still need to know how to pass the session ID to different scripts and then read ....
I tried to do this in the contactus.pl

$thesession = $s;

and to pass it to the confirmation page inside the script.. I added also the session variable at the end:
....cgibin/links/page.cgi?page=confirmation_page&s=$thesession;

But all the code is wrrrrrrrrrrrrrong... any idea... thanks
Mark
Quote Reply
Re: [Mark2] How do you pass session id to another Perl Script In reply to
Could you try: $thesession = $IN->param('s');

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
Quote Reply
Re: [eupos] How do you pass session id to another Perl Script In reply to
Crashed and burned!!!
I got an "Internal Server Error......" when using this arugment...
not working yet...
Quote Reply
Re: [Mark2] How do you pass session id to another Perl Script In reply to
Hmz .. could you post some part of the beginig of this script?

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
Quote Reply
Re: [eupos] How do you pass session id to another Perl Script In reply to
Well! I do not think that is relevent as passing a parmeter to another script should be always the same... maybe...
the program (listed below) works fine without the $thesession... but I want the session to be passed...
I want to to pass and read the session and here is some of the beginging of the code if it help... thanks much:

Code:

#!/usr/bin/crons/perl
$thesession= $IN->param('s');
$mailprog = "/usr/skbin/sendsrmail" ;
$mailto = 'contact_us@domainstest.com';
$subject = "The Free Path Feedback" ;
$formurl = "http://www......../...=1&s=$thesession" ;
$errorurl = "http://www....thedomain......./...=1&s=$thesession";
$thankyouurl = "http://www......etc..../...=1&s=$thesession" ;
# ---------- END OF USER CONFIGURATION SECTION ------------
# ---------- functions -----------
sub redirect_url {
my ( $url ) = shift ;
print "Location: $url\n\n" ;
}
sub parse_form_data {
my ($request_method, $input_string, $content_length) ;
my (@vars, $indiv_var, $name, $value);
my (%form) ;
$request_method = $ENV{'REQUEST_METHOD'} ;
$content_length = $ENV{'CONTENT_LENGTH'} ;
# load the entire string into $input_string
if ($request_method =~ /post/i) {
$input_string = "" ;
read( STDIN, $input_string, $content_length ) ;
}
else {
$input_string = $ENV{ 'QUERY_STRING' };
}
unless (defined $input_string) {
$input_string = "" ;
}
# put all the variable pairs (name=value) into an array
@vars = split( /&/, $input_string );
# process each individual name, value pair, putting them
# into a hash for easy access
.
. and more and more code... then at the end there is:
send_email ( $mailprog, $email, $name, $mailto, $subject, $message );
redirect_url( $thankyouurl );


thanks again...
Mark
Quote Reply
Re: [Mark2] How do you pass session id to another Perl Script In reply to
 

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins