Gossamer Forum
Home : Products : Gossamer Mail : Discussion :

passing info to NoAuth.pm from Join.pm

Quote Reply
passing info to NoAuth.pm from Join.pm
In Join.pm sub send_key we have the validation process where there are two variables - $id and and $key (identifying the userid and validation code). How can I pass these two variables so they are available in sub parse_params of Join.pm?
Quote Reply
Re: [JerryP] passing info to NoAuth.pm from Join.pm In reply to
Hi JerryP,

You would have to add the vars to the $IN GT::CGI object and then run parse_params again. I'm not sure what that's going to do for you though. The sub parse_params in NoAuth.pm is really just looking for things to do and/or pages to print. What are you wanting to do?

Regards,
Charlie
Quote Reply
Re: [CP] passing info to NoAuth.pm from Join.pm In reply to
Yes, you are right. At the end of parse_params, it decides what to print when a user fills out his information and after it's been added to the database (ie, the redirect to the login or the validation entry page).

I'm setting up an optional pay service and when they sign up for the pay one, I need to redirect them somewhere else, like this:
my $url = "https://somedomain/paypage.cgi?id=$id&$key=$key";
print "Location: $url\n\n";

This is only done if they check an input box for the premium account signup and I already have it printing the page without these variables, but I can't figure out how to pass them around.

On the $IN GT::CGI, I can't seem to find that in either file or any info on how to use it... I searched here on that and didn't find any results that appeared to be related (only 3 came up). Any pointers would be greatly appreciated.


Quote Reply
Re: [JerryP] passing info to NoAuth.pm from Join.pm In reply to
So you made some changes to the parse_params sub to do the redirect for you? I think I understand what you are trying to do but I don't think I follow the program flow.

Try this: In the send_key sub, add something like
Code:
$IN->param('user_id_num') = $id;
$IN->param('user_val_key') = $key;
Make sure you use unique key names so you don't overwrite any real keys. Then in parse_params you would need to change your $url to something like this:
Code:
my $url = "https://somedomain/paypage.cgi?id=$IN->param('user_id_num')&key=$IN->param('user_val_key')";
Make sure to back up your files though. This is off the top of my head so you might need to fix it a bit. Let me know how it works.

Regards,
Charlie

Last edited by:

CP: Oct 1, 2001, 10:07 AM
Quote Reply
Re: [CP] passing info to NoAuth.pm from Join.pm In reply to
getting closer Smile when I tried the code you mentioned, I got this error message
Can't modify non-lvalue subroutine call at /www/cgi-bin/mail/admin/GMail/NoAuth/Join.pm line 139.
Line 139 is the first $IN->param line. I couldn't find anything in a search of the forums for lvalue

I also tried rewriting those like this
$IN->param(paykey_id => $id);
$IN->param(paykey_key => $key);
And now I get redirected to where I want to go but the parameters added to the url aren't quite right...
Here's the resulting url I get
domain/cgi-bin/mail/pay.cgi?GT::CGI=HASH(0x810a73c)->param('paykey_id')&GT::CGI=HASH(0x810a73c)->param('paykey_key')
so I think I'm getting closer, now just to figure out the correct setting of those values.

And on the logic of what I'm doing, when a person signs up for an account, they can select a free or pay account. If they select free, I do the regular processing and validation. But if they select a pay account, instead of sending them to the page where they enter their validation code, I need to send them to the secure server (different domain) so they can make payments. The info I want to pass is to avoid using sensitive data in a url string. With this info I can get the user's info from the db and destroy the validation/pay key as soon as they are transferred over to the new server. My goal is automating the entire signup and payment process so I won't have to approve anything. And the sub parse_params determines what page they should go to after the user is inserted in the db, that's why I'm making the changes there.

Last edited by:

JerryP: Oct 1, 2001, 12:40 PM
Quote Reply
Re: [JerryP] passing info to NoAuth.pm from Join.pm In reply to
I guess I forgot how to add params to a CGI object :) See if this will work in the sub parse_params:
Code:
my $id = $IN->param('paykey_id');
my $key = $IN->param('paykey_key');

Then use $id and $key in your $url scalar instead of $IN->param('xxx'). Or will scalar($IN->param('xxx')) work here?

Regards,
Charlie

Quote Reply
Re: [CP] passing info to NoAuth.pm from Join.pm In reply to
Nope... my problem is still back in Join.pm sub send_key and I still get this error message
Can't modify non-lvalue subroutine call at /www/cgi-bin/mail/admin/GMail/NoAuth/Join.pm line 139.
line 139 being
$IN->param('paykey_id') = $id;
and just for fun, if I comment out line 139, I get the same error message but for line 140 which is the key
$IN->param('paykey_key') = $key;

I know the keys are unique, but I don't understand what a non-lvalue subroutine is.

I just added a quick print and exit to display the $id and $key and tried another signup, whcih breaks the program, but prints the info to the error log. The $id is correct for what's inserted, but the $key is cut off at 18 characters instead of the 32 it should be (might be a function of the error logging though). So it seems like the correct values are there, just not getting moved around like they need to from Join.pm
Quote Reply
Re: [JerryP] passing info to NoAuth.pm from Join.pm In reply to
Try to put the vars in the $CFG global instead $IN. Something like
Code:
$CFG->{paykey}->{key} = $key;
$CFG->{paykey}->{id} = $id;
in send_key and make the appropriate changes in parse_params too (my $id = $CFG->{paykey}->{id}).

Regards,
Charlie
Quote Reply
Re: [CP] passing info to NoAuth.pm from Join.pm In reply to
Charlie, I have three words for you:

You Da Man Cool

That last part did exactly what I want. I really appreciate the help. THANK YOU!!!!!
Quote Reply
Re: [JerryP] passing info to NoAuth.pm from Join.pm In reply to
Woohoo! Good thing it worked, I was running out of ideas :)
Quote Reply
Re: [CP] passing info to NoAuth.pm from Join.pm In reply to
Me too... I was just looking at your site, nice. Quick comment, on the webmail part, I think you have a typo on the image that you use in the bottom right corner, powered by x2concept.com (missing the s)... Do you do contract programming work as well?
Quote Reply
Re: [JerryP] passing info to NoAuth.pm from Join.pm In reply to
Thanks for the info on the image, I'll let the webmaster know about it. I'm really not a good enough programmer at this time to do any major contract work but I have been looking for some small jobs. The guy who owns x2concepts.com asked me to help him out about a year ago and it all kinda snowballed from there. I started out installing scripts for him then that turned into modifying and coding new scripts. I guess I really started to actually learn perl within the last 6 months or so and I have a lot to learn still.

Regards,
Charlie