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

new file user login required...

Quote Reply
new file user login required...
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...

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
Subject Author Views Date
Thread new file user login required... jdgamble 4935 Jan 9, 2005, 1:33 PM
Thread Re: [jdgamble] new file user login required...
brewt 4822 Jan 9, 2005, 2:37 PM
Thread Re: [brewt] new file user login required...
jdgamble 4820 Jan 9, 2005, 3:05 PM
Thread Re: [jdgamble] new file user login required...
brewt 4807 Jan 9, 2005, 3:50 PM
Post Re: [brewt] new file user login required...
jdgamble 4823 Jan 9, 2005, 4:47 PM
Thread Re: [jdgamble] new file user login required...
SKN 4803 Jan 28, 2005, 2:39 PM
Thread Re: [SKN] new file user login required...
jdgamble 4775 Jan 28, 2005, 3:41 PM
Thread Re: [jdgamble] new file user login required...
SKN 4768 Jan 28, 2005, 3:52 PM
Thread Re: [SKN] new file user login required...
jdgamble 4765 Jan 28, 2005, 4:05 PM
Thread Re: [jdgamble] new file user login required...
SKN 4787 Jan 28, 2005, 4:26 PM
Post Re: [SKN] new file user login required...
jdgamble 4770 Jan 28, 2005, 4:50 PM
Thread Re: [SKN] new file user login required...
yogi 4774 Jan 29, 2005, 2:38 AM
Post Re: [yogi] new file user login required...
SKN 4777 Jan 29, 2005, 11:15 AM
Thread Re: [yogi] new file user login required...
jdgamble 4731 Jan 29, 2005, 6:07 PM
Post Re: [jdgamble] new file user login required...
yogi 4727 Jan 30, 2005, 4:07 AM
Post Re: [jdgamble] new file user login required...
courierb 4490 Aug 13, 2007, 12:23 AM