Gossamer Forum
Quote Reply
Problem with Code
Hi,

Can anyone see anything that could possibly crash the server or cause any problems in the below code:?



Code:


sub user_signup {
# -------------------------------------------------------------------
# This subroutine will get called whenever the hook 'user_signup'
# is run. You should call GT::Plugins->action ( STOP ) if you don't
# want the regular code to run, otherwise the code will continue as
# normal.
#
my (@args) = @_;
if ($IN->param('action') ){return @args;}
my $opts = Links::Plugins->get_plugin_user_cfg('SignUp');
GT::Plugins->action ( STOP );
my $secondpage = $opts->{SecondSignUpPage};
my $Username = $IN->param('Username');
my $Email = $IN->param('Email');
my $Password = $IN->param('Password');
print "Location: $secondpage&Username=$Username&Email=$Email&Password=$Password\n\n";
return @args;
}
Quote Reply
Re: [Dafyyd] Problem with Code In reply to
Erm, why do you return @args AFTER printing a redirect ;) You could also use the following to redirect;

my $url = "http://www.site.com";
print $IN->redirect($url);

Just an idea Tongue

Can't see any reason why it would crash a server though Unsure

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Problem with Code In reply to
Hi Andy,

If I don't return @args then the script prints an error message along the lines of:

Can't use a scalar(1) as a hash reference, User.Pm line xxx

At the moment all I get in the errorr log is:

GT::Plugins (16115): Plugin post auth_add_user stopped further plugins. at /home/ckd/public_html/sites/cwinfo/admin/GT/Plugins.pm line 120.

Nevertheless, thanks for your help. Not sure why the server is crashing, but the hosting staff tell me it is probably my perl scripts.


I think something may be fundamentally wrong with the code above. Either I am using the wrong hook, or something else may be the matter. It doesn't seem to be very clean .

Last edited by:

Dafyyd: Sep 20, 2002, 5:04 AM
Quote Reply
Re: [Dafyyd] Problem with Code In reply to
Does your server crash or do you just get this error message in the error logs?

If it's the latter, then it's normal. That's what Links SQL writes when you use GT::Plugins->action ( STOP ). I actually don't know the reason why this is written to the error logs, but it's basically not a problem.

Does your code do what you want it to do?

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Problem with Code In reply to
Quote:
I actually don't know the reason why this is written to the error logs, but it's basically not a problem.


It's a bug in GT::Plugins, it displays debug output even when debug is off. =) We'll fix that up.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Dafyyd] Problem with Code In reply to
Nothing wrong with the code, what happens? I can't imagine it crashing a server though. Might try a little debugging to see if you are going to the proper place. Add:

print $IN->header;
print "Would have redirected to '$secondpage&Username=$Username&Email=$Email&Password=$Password\'\n";

and see what it prints.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [yogi] Problem with Code In reply to
GT/Plugins.pm line 99 change:

$self->debug ("Plugin pre $hook_name stopped further plugins.");

to

$self->debug ("Plugin pre $hook_name stopped further plugins.") if ($self->{_debug});

Same on line 120.