For a script that requires user authentication, it should start:
main();
sub main {
if (! $USER) {
my $url = $IN->escape ($IN->url ( absolute => 1, query_string => 1 ));
print $IN->redirect ( $CFG->{db_cgi_url} . "/user.cgi?url=$url" );
return;
}
# you are now logged in and user info is in $USER.
...
}When you call use Links with $USER in it, the program will authenticate the user. If they are not logged in, $USER is undefined. You should then redirect them to the user.cgi script and pass in url=your_current_url. Then once they log in using user.cgi, they get redirect back to your program with the exact same arguments.
Let me know if this makes sense,
Cheers,
Alex
--
Gossamer Threads Inc.
Code:
use Links qw/$IN $DB $USER/; main();
sub main {
if (! $USER) {
my $url = $IN->escape ($IN->url ( absolute => 1, query_string => 1 ));
print $IN->redirect ( $CFG->{db_cgi_url} . "/user.cgi?url=$url" );
return;
}
# you are now logged in and user info is in $USER.
...
}
Let me know if this makes sense,
Cheers,
Alex
--
Gossamer Threads Inc.