I'm creating an external cgi file to do certain things in links that I don't want a user to be able to access without logging in first.
How do I use the linksSQL pre-writing user modules at the top of my perl file so that a user can't access the program without logging in first?
Here is what I have...
#!/usr/bin/perl
#================================
use strict;
use lib 'my path...';
use Links::SiteHTML;
Links::init('my path...');
Links::init_user();
local $SIG{__DIE__} = \&Links::fatal;
main();
sub main {
#---------------------------------------------------
#
if (!$USER) {
# redirect to the login page...
}
else {
# run my sub routine...
}
}
The problem is that even when I am not logged in, it will detect the $USER as existing...
according to modify.pm, add.pm etc, it uses this snip of code...
if ($CFG->{user_required} and ! $USER) {
print $IN->redirect( Links::redirect_login_url('add') );
return;
}
I don't need to define the file as user_required and edit anything complicated, I just want it to simply redirect to the login page if not logged in...
Any suggestions would be appreciated,
Thanks,
- Jonathan
How do I use the linksSQL pre-writing user modules at the top of my perl file so that a user can't access the program without logging in first?
Here is what I have...
Code:
#!/usr/bin/perl
#================================
use strict;
use lib 'my path...';
use Links::SiteHTML;
Links::init('my path...');
Links::init_user();
local $SIG{__DIE__} = \&Links::fatal;
main();
sub main {
#---------------------------------------------------
#
if (!$USER) {
# redirect to the login page...
}
else {
# run my sub routine...
}
}
The problem is that even when I am not logged in, it will detect the $USER as existing...
according to modify.pm, add.pm etc, it uses this snip of code...
Code:
if ($CFG->{user_required} and ! $USER) {
print $IN->redirect( Links::redirect_login_url('add') );
return;
}
I don't need to define the file as user_required and edit anything complicated, I just want it to simply redirect to the login page if not logged in...
Any suggestions would be appreciated,
Thanks,
- Jonathan