This is the only code you should use:
here is the perl file log.cgi
#!/usr/bin/perl
#================================
use strict;
use lib '/home/httpd/vhosts/magicdirectory.com/cgi-bin/admin';
use Links qw/$IN/;
Links::init('/home/httpd/vhosts/magicdirectory.com/cgi-bin/admin');
use Links::SiteHTML;
local $SIG{__DIE__} = \&Links::fatal;
main();
sub main {
#---------------------------------------------------
#
my $username = $IN->cookie('Community_Name') || $IN->param('Community_Name');
print $IN->header;
print Links::SiteHTML::display('include_login', {Username => $username});
}
If you use GCommunity, then make sure you have not renamed your session name under
Setup -> User Session -> session_cookie_name_user
If you do not use GCommunity, then "Community_Name" should be replaced with "s".
You should create a global, say, "login" OR "log" with this sub routine:
sub {
my $output;
if ($ENV{SCRIPT_NAME} =~ /nph-build/) {
$output = '<!--#exec cgi="/cgi-bin/log.cgi" -->';
}
else {
$output = Links::SiteHTML::display('include_login');
}
return $output;
}
<%log%>, which you can put in your include_header.html file, will now automatically check to see what kind of file it is loaded. This requires SSI, so your files must be built with .shtml extension. Remember to also check your cgi paths.
Last but not least, you must create an "include_login" template file with something like this:
<%if Username%>
[<a href='<%db_cgi_url%>/user.cgi?logout=1'>Sign Out</a>,
<a href='<%db_cgi_url%>/user.cgi'>My Account</a>]
<%else%>
<a href="<%db_cgi_url%>/user.cgi">Sign In</a>
<%endif%>
Although javascript can seem easier, it is run from the user end. I am just completly anti-javascript when there is no need for it.
Hope someone uses this,
- Jonathan
Quote:
here is the perl file log.cgi
Code:
#!/usr/bin/perl
#================================
use strict;
use lib '/home/httpd/vhosts/magicdirectory.com/cgi-bin/admin';
use Links qw/$IN/;
Links::init('/home/httpd/vhosts/magicdirectory.com/cgi-bin/admin');
use Links::SiteHTML;
local $SIG{__DIE__} = \&Links::fatal;
main();
sub main {
#---------------------------------------------------
#
my $username = $IN->cookie('Community_Name') || $IN->param('Community_Name');
print $IN->header;
print Links::SiteHTML::display('include_login', {Username => $username});
}
If you use GCommunity, then make sure you have not renamed your session name under
Setup -> User Session -> session_cookie_name_user
If you do not use GCommunity, then "Community_Name" should be replaced with "s".
You should create a global, say, "login" OR "log" with this sub routine:
Code:
sub {
my $output;
if ($ENV{SCRIPT_NAME} =~ /nph-build/) {
$output = '<!--#exec cgi="/cgi-bin/log.cgi" -->';
}
else {
$output = Links::SiteHTML::display('include_login');
}
return $output;
}
<%log%>, which you can put in your include_header.html file, will now automatically check to see what kind of file it is loaded. This requires SSI, so your files must be built with .shtml extension. Remember to also check your cgi paths.
Last but not least, you must create an "include_login" template file with something like this:
Code:
<%if Username%>
[<a href='<%db_cgi_url%>/user.cgi?logout=1'>Sign Out</a>,
<a href='<%db_cgi_url%>/user.cgi'>My Account</a>]
<%else%>
<a href="<%db_cgi_url%>/user.cgi">Sign In</a>
<%endif%>
Although javascript can seem easier, it is run from the user end. I am just completly anti-javascript when there is no need for it.
Hope someone uses this,
- Jonathan