#!/usr/bin/perl # Add the following code to any CGI script that you wish to protect with # UserBase. Adjust the first line below if you've installed UserBase at # somewhere other than $ENV{DOCUMENT_ROOT}/cgi-bin/userbase.cgi. my $userbase_output = `export QUERY_STRING="action=chklogin" && export SCRIPT_NAME="/cgi-bin/userbase.cgi" && "$ENV{DOCUMENT_ROOT}/cgi-bin/userbase.cgi"`; my ($is_admin, $is_member, $username, $userid, $group_memberships, $realname, $email) = ($userbase_output =~ /admin=(\d):::::member=(\d):::::username=(.*?):::::userid=(\d*?):::::group_memberships=(.*?):::::realname=(.*?):::::email=(.*?):::::/s); # Now use those variables to determine a user's login status, for example: print "Content-type: text/plain\n\n"; #print "userbase_output: $userbase_output\n"; print "is_admin: $is_admin\n"; print "is_member: $is_member\n"; print "username: $username\n"; print "userid: $userid\n"; print "group_memberships: $group_memberships\n"; print "realname: $realname\n"; print "email: $email\n";