Diff for /loncom/auth/lonlogin.pm between versions 1.121 and 1.174

version 1.121, 2009/05/16 01:19:29 version 1.174, 2018/11/24 16:19:04
Line 1 Line 1
 # The LearningOnline Network  # The LearningOnline Network
 # Login Screen  # Login Screen
 #  #
 # $Id$  # $Id$
 #  #
 # Copyright Michigan State University Board of Trustees  # Copyright Michigan State University Board of Trustees
 #  #
 # This file is part of the LearningOnline Network with CAPA (LON-CAPA).  # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
 #  #
 # LON-CAPA is free software; you can redistribute it and/or modify  # LON-CAPA is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by  # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or  # the Free Software Foundation; either version 2 of the License, or
 # (at your option) any later version.  # (at your option) any later version.
 #  #
 # LON-CAPA is distributed in the hope that it will be useful,  # LON-CAPA is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of  # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.  # GNU General Public License for more details.
 #  #
 # You should have received a copy of the GNU General Public License  # You should have received a copy of the GNU General Public License
 # along with LON-CAPA; if not, write to the Free Software  # along with LON-CAPA; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #  #
 # /home/httpd/html/adm/gpl.txt  # /home/httpd/html/adm/gpl.txt
 #  #
 # http://www.lon-capa.org/  # http://www.lon-capa.org/
 #  #
   
 package Apache::lonlogin;  package Apache::lonlogin;
   
 use strict;  use strict;
 use Apache::Constants qw(:common);  use Apache::Constants qw(:common);
 use Apache::File ();  use Apache::File ();
 use Apache::lonnet;  use Apache::lonnet;
 use Apache::loncommon();  use Apache::loncommon();
 use Apache::lonauth();  use Apache::lonauth();
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::migrateuser();  use Apache::migrateuser();
 use lib '/home/httpd/lib/perl/';  use lib '/home/httpd/lib/perl/';
 use LONCAPA;  use LONCAPA;
    use CGI::Cookie();
 sub handler {   
     my $r = shift;  sub handler {
       my $r = shift;
     &Apache::loncommon::get_unprocessed_cgi  
  (join('&',$ENV{'QUERY_STRING'},$env{'request.querystring'},      &Apache::loncommon::get_unprocessed_cgi
       $ENV{'REDIRECT_QUERY_STRING'}),   (join('&',$ENV{'QUERY_STRING'},$env{'request.querystring'},
  ['interface','username','domain','firsturl','localpath','localres',        $ENV{'REDIRECT_QUERY_STRING'}),
   'token']);   ['interface','username','domain','firsturl','localpath','localres',
     if (!defined($env{'form.firsturl'})) {    'token','role','symb','iptoken']);
         &Apache::lonacc::get_posted_cgi($r,['firsturl']);      if (!defined($env{'form.firsturl'})) {
     }          &Apache::lonacc::get_posted_cgi($r,['firsturl']);
       }
 # -- check if they are a migrating user      if (!defined($env{'form.firsturl'})) {
     if (defined($env{'form.token'})) {          if ($ENV{'REDIRECT_URL'} =~ m{^/+tiny/+$LONCAPA::match_domain/+\w+$}) {
  return &Apache::migrateuser::handler($r);              $env{'form.firsturl'} = $ENV{'REDIRECT_URL'};
     }          }
       }
     &Apache::loncommon::no_cache($r);  
     &Apache::lonlocal::get_language_handle($r);  # -- check if they are a migrating user
     &Apache::loncommon::content_type($r,'text/html');      if (defined($env{'form.token'})) {
     $r->send_http_header;   return &Apache::migrateuser::handler($r);
     return OK if $r->header_only;      }
   
   # For "public user" - remove any exising "public" cookie, as user really wants to log-in
 # Are we re-routing?      my ($handle,$lonidsdir,$expirepub,$userdom);
     if (-e '/home/httpd/html/lon-status/reroute.txt') {      unless ($r->header_only) {
  &Apache::lonauth::reroute($r);          $handle = &Apache::lonnet::check_for_valid_session($r,'lonID',undef,\$userdom);
  return OK;          if ($handle ne '') {
     }              $lonidsdir=$r->dir_config('lonIDsDir');
               if ($handle=~/^publicuser\_/) {
                   unlink($r->dir_config('lonIDsDir')."/$handle.id");
 # -------------------------------- Prevent users from attempting to login twice                  undef($handle);
     my $handle = &Apache::lonnet::check_for_valid_session($r);                  undef($userdom);
     if ($handle=~/^publicuser\_/) {                  $expirepub = 1;
 # For "public user" - remove it, we apparently really want to login              }
  unlink($r->dir_config('lonIDsDir')."/$handle.id");          }
     } elsif ($handle ne '') {      }
 # Indeed, a valid token is found  
  my $start_page =       &Apache::loncommon::no_cache($r);
     &Apache::loncommon::start_page('Already logged in');      &Apache::lonlocal::get_language_handle($r);
  my $end_page =       &Apache::loncommon::content_type($r,'text/html');
     &Apache::loncommon::end_page();      if ($expirepub) {
  $r->print(          my $c = new CGI::Cookie(-name    => 'lonPubID',
                   $start_page                                  -value   => '',
                  .'<h1>'.&mt('You are already logged in!').'</h1>'                                  -expires => '-10y',);
                  .'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].',          $r->header_out('Set-cookie' => $c);
                   '<a href="/adm/roles">','</a>','<a href="/adm/logout">','</a>').'</p>'      } elsif (($handle eq '') && ($userdom ne '')) {
                  .'<p><a href="/adm/loginproblems.html">'.&mt('Login problems?').'</a></p>'          my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));
                  .$end_page          foreach my $name (keys(%cookies)) {
                  );              next unless ($name =~ /^lon(|S|Link|Pub)ID$/);
         return OK;              my $c = new CGI::Cookie(-name    => $name,
     }                                      -value   => '',
                                       -expires => '-10y',);
 # ---------------------------------------------------- No valid token, continue              $r->headers_out->add('Set-cookie' => $c);
           }
  # ---------------------------- Not possible to really login to domain "public"      }
     if ($env{'form.domain'} eq 'public') {      $r->send_http_header;
  $env{'form.domain'}='';      return OK if $r->header_only;
  $env{'form.username'}='';  
     }  
 # ----------------------------------------------------------- Process Interface  # Are we re-routing?
     $env{'form.interface'}=~s/\W//g;      my $londocroot = $r->dir_config('lonDocRoot');
       if (-e "$londocroot/lon-status/reroute.txt") {
     my $httpbrowser=$ENV{"HTTP_USER_AGENT"};   &Apache::lonauth::reroute($r);
    return OK;
     my $iconpath=       }
  &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));  
       $env{'form.firsturl'} =~ s/(`)/'/g;
     my $domain = &Apache::lonnet::default_login_domain();  
     if (($env{'form.domain'}) &&   # Check if browser sent a LON-CAPA load balancer cookie (and this is a balancer)
  (&Apache::lonnet::domain($env{'form.domain'},'description'))) {  
  $domain=$env{'form.domain'};      my ($found_server,$balancer_cookie) = &Apache::lonnet::check_for_balancer_cookie($r,1);
     }      if ($found_server) {
     my $role    = $r->dir_config('lonRole');          my $hostname = &Apache::lonnet::hostname($found_server);
     my $loadlim = $r->dir_config('lonLoadLim');          if ($hostname ne '') {
     my $servadm = $r->dir_config('lonAdmEMail');              my $protocol = $Apache::lonnet::protocol{$found_server};
     my $lonhost = $r->dir_config('lonHostID');              $protocol = 'http' if ($protocol ne 'https');
     my $tabdir  = $r->dir_config('lonTabDir');              my $dest = '/adm/roles';
     my $include = $r->dir_config('lonIncludes');              if ($env{'form.firsturl'} ne '') {
     my $expire  = $r->dir_config('lonExpire');                  $dest = $env{'form.firsturl'};
     my $version = $r->dir_config('lonVersion');              }
     my $host_name = &Apache::lonnet::hostname($lonhost);              my $url = $protocol.'://'.$hostname.$dest;
               my $start_page =
 # --------------------------------------------- Default values for login fields                  &Apache::loncommon::start_page('Switching Server ...',undef,
                                                  {'redirect'       => [0,$url],});
     my $authusername=($env{'form.username'}?$env{'form.username'}:'');              my $end_page   = &Apache::loncommon::end_page();
     my $authdomain=($env{'form.domain'}?$env{'form.domain'}:$domain);              $r->print($start_page.$end_page);
               return OK;
 # ---------------------------------------------------------- Determine own load          }
     my $loadavg;      }
     {  
  my $loadfile=Apache::File->new('/proc/loadavg');  #
  $loadavg=<$loadfile>;  # If browser sent an old cookie for which the session file had been removed
     }  # check if configuration for user's domain has a portal URL set.  If so
     $loadavg =~ s/\s.*//g;  # switch user's log-in to the portal.
     my $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);  #
     my $userloadpercent=&Apache::lonnet::userload();  
       if (($handle eq '') && ($userdom ne '')) {
 # ------------------------------------------------------- Do the load balancing          my %domdefaults = &Apache::lonnet::get_domain_defaults($userdom);
     my $otherserver= &Apache::lonnet::absolute_url($host_name);          if ($domdefaults{'portal_def'} =~ /^https?\:/) {
     my $firsturl=              my $start_page = &Apache::loncommon::start_page('Switching Server ...',undef,
     ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});                                            {'redirect' => [0,$domdefaults{'portal_def'}],});
 # ---------------------------------------------------------- Are we overloaded?              my $end_page   = &Apache::loncommon::end_page();
     if ((($userloadpercent>100.0)||($loadpercent>100.0))) {              $r->print($start_page.$end_page);
         my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent);              return OK;
  if ($unloaded) { $otherserver=$unloaded; }          }
     }      }
   
 # ----------------------------------------------------------- Get announcements  # -------------------------------- Prevent users from attempting to login twice
     my $announcements=&Apache::lonnet::getannounce();      if ($handle ne '') {
 # -------------------------------------------------------- Set login parameters          &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);
    my $start_page =
     my @hexstr=('0','1','2','3','4','5','6','7',      &Apache::loncommon::start_page('Already logged in');
                 '8','9','a','b','c','d','e','f');   my $end_page =
     my $lkey='';      &Apache::loncommon::end_page();
     for (0..7) {          my $dest = '/adm/roles';
         $lkey.=$hexstr[rand(15)];          if ($env{'form.firsturl'} ne '') {
     }              $dest = $env{'form.firsturl'};
           }
     my $ukey='';   $r->print(
     for (0..7) {                    $start_page
         $ukey.=$hexstr[rand(15)];                   .'<p class="LC_warning">'.&mt('You are already logged in!').'</p>'
     }                   .'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].',
                     '<a href="'.$dest.'">','</a>','<a href="/adm/logout">','</a>').'</p>'
     my $lextkey=hex($lkey);                   .$end_page
     if ($lextkey>2147483647) { $lextkey-=4294967296; }                   );
           return OK;
     my $uextkey=hex($ukey);      }
     if ($uextkey>2147483647) { $uextkey-=4294967296; }  
   # ---------------------------------------------------- No valid token, continue
 # -------------------------------------------------------- Store away log token  
     my $logtoken=Apache::lonnet::reply(  # ---------------------------- Not possible to really login to domain "public"
        'tmpput:'.$ukey.$lkey.'&'.$firsturl,      if ($env{'form.domain'} eq 'public') {
        $lonhost);   $env{'form.domain'}='';
    $env{'form.username'}='';
 # ------------------- If we cannot talk to ourselves, we are in serious trouble      }
   
     if ($logtoken eq 'con_lost') {  # ------ Is this page requested because /adm/migrateuser detected an IP change?
         my $spares='';      my %sessiondata;
  my $last;      if ($env{'form.iptoken'}) {
         foreach my $hostid (sort          %sessiondata = &Apache::lonnet::tmpget($env{'form.iptoken'});
     {          unless ($sessiondata{'sessionserver'}) {
  &Apache::lonnet::hostname($a) cmp              my $delete = &Apache::lonnet::tmpdel($env{'form.iptoken'});
     &Apache::lonnet::hostname($b);              delete($env{'form.iptoken'});
     }          }
     keys(%Apache::lonnet::spareid)) {      }
             next if ($hostid eq $lonhost);  # ----------------------------------------------------------- Process Interface
     my $hostname = &Apache::lonnet::hostname($hostid);      $env{'form.interface'}=~s/\W//g;
     next if ($last eq $hostname);  
             $spares.='<br /><font size="+1"><a href="http://'.      (undef,undef,undef,undef,undef,undef,my $clientmobile) =
                 $hostname.          &Apache::loncommon::decode_user_agent();
                 '/adm/login?domain='.$authdomain.'">'.  
                 $hostname.'</a>'.      my $iconpath=
                 ' '.&mt('(preferred)').'</font>'.$/;   &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));
     $last=$hostname;  
         }      my $lonhost = $r->dir_config('lonHostID');
 $spares.= '<br />';      my $domain = &Apache::lonnet::default_login_domain();
 my %all_hostnames = &Apache::lonnet::all_hostnames();      my $defdom = $domain;
 foreach my $hostid (sort      if ($lonhost ne '') {
     {          unless ($sessiondata{'sessionserver'}) {
  &Apache::lonnet::hostname($a) cmp              my $redirect = &check_loginvia($domain,$lonhost);
     &Apache::lonnet::hostname($b);              if ($redirect) {
     }                  $r->print($redirect);
     keys(%all_hostnames)) {                  return OK;
     next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});              }
     my $hostname = &Apache::lonnet::hostname($hostid);          }
     next if ($last eq $hostname);      }
     $spares.='<br /><a href="http://'.  
  $hostname.      if (($sessiondata{'domain'}) &&
  '/adm/login?domain='.$authdomain.'">'.          (&Apache::lonnet::domain($env{'form.domain'},'description'))) {
  $hostname.'</a>';          $domain=$sessiondata{'domain'};
     $last=$hostname;      } elsif (($env{'form.domain'}) &&
 }   (&Apache::lonnet::domain($env{'form.domain'},'description'))) {
 $r->print(   $domain=$env{'form.domain'};
    '<html>'      }
   .'<head><title>'  
   .&mt('The LearningOnline Network with CAPA')      my $role    = $r->dir_config('lonRole');
   .'</title></head>'      my $loadlim = $r->dir_config('lonLoadLim');
   .'<body bgcolor="#FFFFFF">'      my $uloadlim= $r->dir_config('lonUserLoadLim');
   .'<h1>'.&mt('The LearningOnline Network with CAPA').'</h1>'      my $servadm = $r->dir_config('lonAdmEMail');
   .'<img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />'      my $tabdir  = $r->dir_config('lonTabDir');
   .'<h3>'.&mt('This LON-CAPA server is temporarily not available for login.').'</h3>'      my $include = $r->dir_config('lonIncludes');
   .'<p>'.&mt('Please attempt to login to one of the following servers:').'</p>'      my $expire  = $r->dir_config('lonExpire');
   .$spares      my $version = $r->dir_config('lonVersion');
   .'</body>'      my $host_name = &Apache::lonnet::hostname($lonhost);
   .'</html>'  
 );  # --------------------------------------------- Default values for login fields
 return OK;     
 }      my ($authusername,$authdomain);
       if ($sessiondata{'username'}) {
 # ----------------------------------------------- Apparently we are in business          $authusername=$sessiondata{'username'};
 $servadm=~s/\,/\<br \/\>/g;      } else {
           $env{'form.username'} = &Apache::loncommon::cleanup_html($env{'form.username'});
 # ----------------------------------------------------------- Front page design          $authusername=($env{'form.username'}?$env{'form.username'}:'');
 my $pgbg=&Apache::loncommon::designparm('login.pgbg',$domain);      }
 my $font=&Apache::loncommon::designparm('login.font',$domain);      if ($sessiondata{'domain'}) {
 my $link=&Apache::loncommon::designparm('login.link',$domain);          $authdomain=$sessiondata{'domain'};
 my $vlink=&Apache::loncommon::designparm('login.vlink',$domain);      } else {
 my $alink=&Apache::loncommon::designparm('login.alink',$domain);          $env{'form.domain'} = &Apache::loncommon::cleanup_html($env{'form.domain'});
 my $mainbg=&Apache::loncommon::designparm('login.mainbg',$domain);          $authdomain=($env{'form.domain'}?$env{'form.domain'}:$domain);
 my $logo=&Apache::loncommon::designparm('login.logo',$domain);      }
 my $img=&Apache::loncommon::designparm('login.img',$domain);  
 my $domainlogo=&Apache::loncommon::domainlogo($domain);  # ---------------------------------------------------------- Determine own load
 my $login=&Apache::loncommon::designparm('login.login',$domain);      my $loadavg;
 if ($login eq '') {      {
 $login = $iconpath.'/'.&mt('userauthentication.gif');   my $loadfile=Apache::File->new('/proc/loadavg');
 }   $loadavg=<$loadfile>;
 my $showbanner = 1;      }
 my $showmainlogo = 1;      $loadavg =~ s/\s.*//g;
 if (defined(&Apache::loncommon::designparm('login.showlogo_img',$domain))) {  
     $showbanner = &Apache::loncommon::designparm('login.showlogo_img',$domain);      my ($loadpercent,$userloadpercent);
 }      if ($loadlim) {
 if (defined(&Apache::loncommon::designparm('login.showlogo_logo',$domain))) {          $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);
     $showmainlogo = &Apache::loncommon::designparm('login.showlogo_logo',$domain);      }
 }      if ($uloadlim) {
 my $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain);          $userloadpercent=&Apache::lonnet::userload();
 my $showcoursecat =      }
 &Apache::loncommon::designparm('login.coursecatalog',$domain);  
 my $loginheader =&Apache::loncommon::designparm('login.loginheader',$domain);      my $firsturl=
 my $shownewuserlink =       ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});
 &Apache::loncommon::designparm('login.newuser',$domain);  
 my $now=time;  # ----------------------------------------------------------- Get announcements
 my $js = (<<ENDSCRIPT);      my $announcements=&Apache::lonnet::getannounce();
   # -------------------------------------------------------- Set login parameters
 <script type="text/javascript" language="JavaScript">  
 function send()      my @hexstr=('0','1','2','3','4','5','6','7',
 {                  '8','9','a','b','c','d','e','f');
 this.document.server.elements.uname.value      my $lkey='';
 =this.document.client.elements.uname.value;      for (0..7) {
           $lkey.=$hexstr[rand(15)];
 this.document.server.elements.udom.value      }
 =this.document.client.elements.udom.value;  
       my $ukey='';
 uextkey=this.document.client.elements.uextkey.value;      for (0..7) {
 lextkey=this.document.client.elements.lextkey.value;          $ukey.=$hexstr[rand(15)];
 initkeys();      }
   
 this.document.server.elements.upass0.value      my $lextkey=hex($lkey);
     =crypted(this.document.client.elements.upass$now.value.substr(0,15));      if ($lextkey>2147483647) { $lextkey-=4294967296; }
 this.document.server.elements.upass1.value  
     =crypted(this.document.client.elements.upass$now.value.substr(15,15));      my $uextkey=hex($ukey);
 this.document.server.elements.upass2.value      if ($uextkey>2147483647) { $uextkey-=4294967296; }
     =crypted(this.document.client.elements.upass$now.value.substr(30,15));  
   # -------------------------------------------------------- Store away log token
 this.document.client.elements.uname.value='';      my $tokenextras;
 this.document.client.elements.upass$now.value='';      if ($env{'form.role'}) {
           $tokenextras = '&role='.&escape($env{'form.role'});
 this.document.server.submit();      }
 return false;      if ($env{'form.symb'}) {
 }          if (!$tokenextras) {
 </script>              $tokenextras = '&';
           }
 ENDSCRIPT          $tokenextras .= '&symb='.&escape($env{'form.symb'});
       }
 # --------------------------------------------------- Print login screen header      if ($env{'form.iptoken'}) {
           if (!$tokenextras) {
 my %add_entries = (              $tokenextras = '&&';
        bgcolor      => "$mainbg",          }
        text         => "$font",          $tokenextras .= '&iptoken='.&escape($env{'form.iptoken'});
        link         => "$link",      }
        vlink        => "$vlink",      my $logtoken=Apache::lonnet::reply(
        alink        => "$alink",);         'tmpput:'.$ukey.$lkey.'&'.$firsturl.$tokenextras,
          $lonhost);
 $r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',$js,  
        { 'redirect'       => [$expire,'/adm/roles'],   # -- If we cannot talk to ourselves, or hostID does not map to a hostname
  'add_entries' => \%add_entries,  #    we are in serious trouble
  'only_body'   => 1,}));  
       if (($logtoken eq 'con_lost') || ($logtoken eq 'no_such_host')) {
 # ----------------------------------------------------------------------- Texts          if ($logtoken eq 'no_such_host') {
               &Apache::lonnet::logthis('No valid logtoken for log-in page -- unable to determine hostname for hostID: '.$lonhost.'. Check entry in hosts.tab');
 my %lt=&Apache::lonlocal::texthash(          }
   'un'  => 'Username',          my $spares='';
   'pw'  => 'Password',   my $last;
   'dom' => 'Domain',          foreach my $hostid (sort
   'perc' => 'percent',      {
   'load' => 'Server Load',   &Apache::lonnet::hostname($a) cmp
   'userload' => 'User Load',      &Apache::lonnet::hostname($b);
   'catalog' => 'Course Catalog',      }
   'log' => 'Log in',      keys(%Apache::lonnet::spareid)) {
   'help' => 'Log-in Help',              next if ($hostid eq $lonhost);
   'serv' => 'Server',      my $hostname = &Apache::lonnet::hostname($hostid);
   'servadm' => 'Server Administration',      next if (($last eq $hostname) || ($hostname eq ''));
   'helpdesk' => 'Contact Helpdesk',              $spares.='<br /><font size="+1"><a href="http://'.
   'forgotpw' => 'Forgot password?',                  $hostname.
   'newuser'  => 'New User?',                  '/adm/login?domain='.$authdomain.'">'.
   );                  $hostname.'</a>'.
 # -------------------------------------------------- Change password field name                  ' '.&mt('(preferred)').'</font>'.$/;
 my $forgotpw = &forgotpwdisplay(%lt);      $last=$hostname;
 my $loginhelp = &loginhelpdisplay(%lt);          }
           if ($spares) {
 # ---------------------------------------------------- Serve out DES JavaScript              $spares.= '<br />';
 {          }
 my $jsh=Apache::File->new($include."/londes.js");          my %all_hostnames = &Apache::lonnet::all_hostnames();
 $r->print(<$jsh>);          foreach my $hostid (sort
 }      {
 # ---------------------------------------------------------- Serve rest of page   &Apache::lonnet::hostname($a) cmp
       &Apache::lonnet::hostname($b);
 $r->print(      }
   '<div class="LC_loginpage_container">');      keys(%all_hostnames)) {
               next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});
 #              my $hostname = &Apache::lonnet::hostname($hostid);
 #  If the loadbalancing yielded just http:// because perhaps there's no loadbalancing?              next if (($last eq $hostname) || ($hostname eq ''));
 #  then just us a relative link to authenticate:              $spares.='<br /><a href="http://'.
 #               $hostname.
                '/adm/login?domain='.$authdomain.'">'.
 $r->print(<<ENDSERVERFORM);               $hostname.'</a>';
 <form name="server" action="$otherserver/adm/authenticate" method="post" target="_top">              $last=$hostname;
    <input type="hidden" name="logtoken" value="$logtoken" />           }
    <input type="hidden" name="serverid" value="$lonhost" />           $r->print(
    <input type="hidden" name="uname" value="" />     '<html>'
    <input type="hidden" name="upass0" value="" />    .'<head><title>'
    <input type="hidden" name="upass1" value="" />    .&mt('The LearningOnline Network with CAPA')
    <input type="hidden" name="upass2" value="" />    .'</title></head>'
    <input type="hidden" name="udom" value="" />    .'<body bgcolor="#FFFFFF">'
    <input type="hidden" name="localpath" value="$env{'form.localpath'}" />    .'<h1>'.&mt('The LearningOnline Network with CAPA').'</h1>'
    <input type="hidden" name="localres" value="$env{'form.localres'}" />    .'<img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />'
   </form>    .'<h3>'.&mt('This LON-CAPA server is temporarily not available for login.').'</h3>');
 ENDSERVERFORM          if ($spares) {
 my $coursecatalog;              $r->print('<p>'.&mt('Please attempt to login to one of the following servers:')
 if (($showcoursecat eq '') || ($showcoursecat)) {                       .'</p>'
     $coursecatalog = &coursecatalog_link($lt{'catalog'});                       .$spares);
 }          }
 my $newuserlink;          $r->print('</body>'
 if ($shownewuserlink) {                   .'</html>'
     $newuserlink = &newuser_link($lt{'newuser'}).'<br />';          );
 }          return OK;
 my $logintitle;      }
 if ($loginheader eq 'text') {  
     $logintitle ='<h2>'.$lt{'log'}.'</h2>';  # ----------------------------------------------- Apparently we are in business
 } else {      $servadm=~s/\,/\<br \/\>/g;
     $logintitle = '<img src="'.$login.'" alt="'.  
                   &mt('User Authentication').'" />';  # ----------------------------------------------------------- Front page design
 }      my $pgbg=&Apache::loncommon::designparm('login.pgbg',$domain);
       my $font=&Apache::loncommon::designparm('login.font',$domain);
 my $noscript_warning='<noscript><span class="LC_warning"><b>'      my $link=&Apache::loncommon::designparm('login.link',$domain);
                      .&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.')      my $vlink=&Apache::loncommon::designparm('login.vlink',$domain);
                     .'</b></span></noscript>';      my $alink=&Apache::loncommon::designparm('login.alink',$domain);
 my $helpdeskscript;      my $mainbg=&Apache::loncommon::designparm('login.mainbg',$domain);
 my $contactblock = &contactdisplay(\%lt,$servadm,$showadminmail,      my $loginbox_bg=&Apache::loncommon::designparm('login.sidebg',$domain);
                             $version,$authdomain,\$helpdeskscript);      my $loginbox_header_bgcol=&Apache::loncommon::designparm('login.bgcol',$domain);
       my $loginbox_header_textcol=&Apache::loncommon::designparm('login.textcol',$domain);
 my $loginform=(<<LFORM);      my $logo=&Apache::loncommon::designparm('login.logo',$domain);
 <form name="client" onsubmit="return(send())">      my $img=&Apache::loncommon::designparm('login.img',$domain);
   <input type="hidden" name="lextkey" value="$lextkey" />      my $domainlogo=&Apache::loncommon::domainlogo($domain);
   <input type="hidden" name="uextkey" value="$uextkey" />      my $showbanner = 1;
   <b><label for="uname">$lt{'un'}</label>:</b><br />      my $showmainlogo = 1;
   <input type="text" name="uname" size="15" value="$authusername" /><br />      if (defined(&Apache::loncommon::designparm('login.showlogo_img',$domain))) {
   <b><label for="upass$now">$lt{'pw'}</label>:</b><br />          $showbanner = &Apache::loncommon::designparm('login.showlogo_img',$domain);
   <input type="password" name="upass$now" size="15" /><br />      }
   <b><label for="udom">$lt{'dom'}</label>:</b><br />      if (defined(&Apache::loncommon::designparm('login.showlogo_logo',$domain))) {
   <input type="text" name="udom" size="15" value="$authdomain" /><br />          $showmainlogo = &Apache::loncommon::designparm('login.showlogo_logo',$domain);
   <input type="submit" value="$lt{'log'}" />      }
 </form>      my $showadminmail;
 LFORM      my @possdoms = &Apache::lonnet::current_machine_domains();
       if (grep(/^\Q$domain\E$/,@possdoms)) {
     if ($showbanner) {          $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain);
         $r->print(<<HEADER);      }
 <!-- The LON-CAPA Header -->      my $showcoursecat =
 <table border="0" align="left" width="100%" cellspacing="0" cellpadding="1">          &Apache::loncommon::designparm('login.coursecatalog',$domain);
  <tr>      my $shownewuserlink =
   <td align="left" valign="top" bgcolor="$pgbg">          &Apache::loncommon::designparm('login.newuser',$domain);
       <img src="$img" border="0" alt="The Learning Online Network with CAPA" />      my $showhelpdesk =
   </td>          &Apache::loncommon::designparm('login.helpdesk',$domain);
  </tr>      my $now=time;
 </table>      my $js = (<<ENDSCRIPT);
 HEADER  
     }  <script type="text/javascript" language="JavaScript">
     $r->print(<<ENDTOP);  // <![CDATA[
 <div class="LC_loginpage_space">&nbsp;</div>  function send()
 <div class="LC_loginpage_floatLeft">  {
 <div class="LC_loginpage_loginContainer">  this.document.server.elements.uname.value
   $logintitle  =this.document.client.elements.uname.value;
    <table border="0" align="left" cellspacing="1" cellpadding="2" width="100%">  
       <tr>  this.document.server.elements.udom.value
    <td>  =this.document.client.elements.udom.value;
  $loginform  
            </td>  uextkey=this.document.client.elements.uextkey.value;
       </tr>  lextkey=this.document.client.elements.lextkey.value;
    </table>    initkeys();
    $noscript_warning  
 </div>  if(this.document.server.action.substr(0,5) === 'http:'){
         this.document.server.elements.upass0.value
 <div class="LC_loginpage_loginInfo">          =getCrypted(this.document.client.elements.upass$now.value);
         $loginhelp<br />  } else {
         $forgotpw<br />      this.document.server.elements.upass0.value
  $contactblock<br />          =this.document.client.elements.upass$now.value;
         $newuserlink  }
         $coursecatalog  
 </div>  this.document.client.elements.uname.value='';
 </div>  this.document.client.elements.upass$now.value='';
 ENDTOP  
     if ($showmainlogo) {  this.document.server.submit();
         $r->print(' <img src="'.$logo.'" alt="" />'."\n");  return false;
     }  }
 $r->print(<<ENDTOP);  
 $announcements  function enableInput() {
 $domainlogo      this.document.client.elements.upass$now.removeAttribute("readOnly");
 <div class="LC_loginpage_space">&nbsp;</div>      this.document.client.elements.uname.removeAttribute("readOnly");
 ENDTOP      this.document.client.elements.udom.removeAttribute("readOnly");
       return;
 $r->print(<<ENDDOCUMENT);  }
      <table border="0" cellspacing="0" cellpadding="0">  
       <tr>  // ]]>
        <td  align="left" valign="top">  </script>
         <small><b>&nbsp;&nbsp;&nbsp;$lt{'dom'}:&nbsp;</b></small>  
        </td>  ENDSCRIPT
        <td  align="left" valign="top">  
         <small><tt>&nbsp;$domain</tt></small>  # --------------------------------------------------- Print login screen header
        </td>  
       </tr>      my %add_entries = (
       <tr>         bgcolor      => "$mainbg",
        <td  align="left" valign="top">         text         => "$font",
         <small><b>&nbsp;&nbsp;&nbsp;$lt{'serv'}:&nbsp;</b></small>         link         => "$link",
        </td>         vlink        => "$vlink",
        <td align="left" valign="top">         alink        => "$alink",
         <small><tt>&nbsp;$lonhost ($role)</tt></small>                 onload       => 'javascript:enableInput();',);
        </td>  
       </tr>      my ($lonhost_in_use,$headextra,$headextra_exempt,@hosts,%defaultdomconf);
       <tr>      @hosts = &Apache::lonnet::current_machine_ids();
        <td align="left" valign="top">      $lonhost_in_use = $lonhost;
         <small><b>&nbsp;&nbsp;&nbsp;$lt{'load'}:&nbsp;</b></small>      if (@hosts > 1) {
        </td>          foreach my $hostid (@hosts) {
        <td align="left" valign="top">              if (&Apache::lonnet::host_domain($hostid) eq $defdom) {
         <small><tt>&nbsp;$loadpercent $lt{'perc'}</tt></small>                  $lonhost_in_use = $hostid;
        </td>                  last;
       </tr>              }
       <tr>          }
        <td align="left" valign="top">      }
         <small><b>&nbsp;&nbsp;&nbsp;$lt{'userload'}:&nbsp;</b></small>      %defaultdomconf = &Apache::loncommon::get_domainconf($defdom);
        </td>      $headextra = $defaultdomconf{$defdom.'.login.headtag_'.$lonhost_in_use};
        <td align="left" valign="top">      $headextra_exempt = $defaultdomconf{$domain.'.login.headtag_exempt_'.$lonhost_in_use};
         <small><tt>&nbsp;$userloadpercent $lt{'perc'}</tt></small>      if ($headextra) {
        </td>          my $omitextra;
       </tr>          if ($headextra_exempt ne '') {
      </table>              my @exempt = split(',',$headextra_exempt);
  </div>              my $ip = $ENV{'REMOTE_ADDR'};
               if (grep(/^\Q$ip\E$/,@exempt)) {
 <script type="text/javascript">                  $omitextra = 1;
 // the if prevents the script error if the browser can not handle this              }
 if ( document.client.uname ) { document.client.uname.focus(); }          }
 </script>          unless ($omitextra) {
 $helpdeskscript              my $confname = $defdom.'-domainconfig';
               if ($headextra =~ m{^\Q/res/$defdom/$confname/login/headtag/$lonhost_in_use/\E}) {
 ENDDOCUMENT                  my $extra = &Apache::lonnet::getfile(&Apache::lonnet::filelocation("",$headextra));
     my %endargs = ( 'noredirectlink' => 1, );                  unless ($extra eq '-1') {
     $r->print(&Apache::loncommon::end_page(\%endargs));                      $js .= "\n".$extra."\n";
     return OK;                  }
 }              }
           }
 sub contactdisplay {      }
     my ($lt,$servadm,$showadminmail,$version,$authdomain,$helpdeskscript) = @_;  
     my $contactblock;      $r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',$js,
     my $showhelpdesk = 0;         { 'redirect'       => [$expire,'/adm/roles'],
     my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};   'add_entries' => \%add_entries,
     if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {   'only_body'   => 1,}));
         $showhelpdesk = 1;  
     }  # ----------------------------------------------------------------------- Texts
     if ($servadm && $showadminmail) {  
         $contactblock .= '<b>&nbsp;&nbsp;&nbsp;'.$$lt{'servadm'}.':</b><br />'.      my %lt=&Apache::lonlocal::texthash(
                          '<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$servadm.'</tt><br />&nbsp;<br />';            'un'       => 'Username',
     }            'pw'       => 'Password',
     if ($showhelpdesk) {            'dom'      => 'Domain',
         $contactblock .= '<a href="javascript:helpdesk()">'.$lt->{'helpdesk'}.'</a><br />';            'perc'     => 'percent',
         my $thisurl = &escape('/adm/login');            'load'     => 'Server Load',
         $$helpdeskscript = <<"ENDSCRIPT";            'userload' => 'User Load',
 <script type="text/javascript">            'catalog'  => 'Course/Community Catalog',
 function helpdesk() {            'log'      => 'Log in',
     var codedom = document.client.udom.value;            'help'     => 'Log-in Help',
     if (codedom == '') {            'serv'     => 'Server',
         codedom = "$authdomain";            'servadm'  => 'Server Administration',
     }            'helpdesk' => 'Contact Helpdesk',
     var querystr = "origurl=$thisurl&codedom="+codedom;            'forgotpw' => 'Forgot password?',
     document.location.href = "/adm/helpdesk?"+querystr;            'newuser'  => 'New User?',
     return;         );
 }  # -------------------------------------------------- Change password field name
 </script>  
 ENDSCRIPT      my $forgotpw = &forgotpwdisplay(%lt);
     }      $forgotpw .= '<br />' if $forgotpw;
     $contactblock .= <<"ENDBLOCK";      my $loginhelp = &Apache::lonauth::loginhelpdisplay($authdomain);
      &nbsp;&nbsp;&nbsp;$version      if ($loginhelp) {
 ENDBLOCK          $loginhelp = '<a href="'.$loginhelp.'">'.$lt{'help'}.'</a><br />';
     return $contactblock;      }
 }  
   # ---------------------------------------------------- Serve out DES JavaScript
 sub forgotpwdisplay {      {
     my (%lt) = @_;      my $jsh=Apache::File->new($include."/londes.js");
     my $prompt_for_resetpw = 1;       $r->print(<$jsh>);
     if ($prompt_for_resetpw) {      }
         return '<a href="/adm/resetpw">'.$lt{'forgotpw'}.'</a>';  # ---------------------------------------------------------- Serve rest of page
     }  
     return;      $r->print(
 }      '<div class="LC_Box"'
      .' style="margin:0 auto; padding:10px; width:90%; height: auto; background-color:#FFFFFF;">'
 sub loginhelpdisplay {  );
     my (%lt) = @_;  
     my $login_help = 1;      $r->print(<<ENDSERVERFORM);
     if ($login_help) {  <form name="server" action="/adm/authenticate" method="post" target="_top">
         return '<a href="/adm/loginproblems.html">'.$lt{'help'}.'</a>';     <input type="hidden" name="logtoken" value="$logtoken" />
     }     <input type="hidden" name="serverid" value="$lonhost" />
     return;     <input type="hidden" name="uname" value="" />
 }     <input type="hidden" name="upass0" value="" />
      <input type="hidden" name="udom" value="" />
 sub coursecatalog_link {     <input type="hidden" name="localpath" value="$env{'form.localpath'}" />
     my ($linkname) = @_;     <input type="hidden" name="localres" value="$env{'form.localres'}" />
     return <<"END";    </form>
       <a href="/adm/coursecatalog">$linkname</a>  ENDSERVERFORM
 END      my $coursecatalog;
 }      if (($showcoursecat eq '') || ($showcoursecat)) {
           $coursecatalog = &coursecatalog_link($lt{'catalog'}).'<br />';
 sub newuser_link {      }
     my ($linkname) = @_;      my $newuserlink;
     return '&nbsp;&nbsp;&nbsp;<a href="/adm/createaccount"><b>'.$linkname.'</b></a><br />';      if ($shownewuserlink) {
 }          $newuserlink = &newuser_link($lt{'newuser'}).'<br />';
       }
 1;      my $logintitle =
 __END__          '<h2 class="LC_hcell"'
          .' style="background:'.$loginbox_header_bgcol.';'
          .' color:'.$loginbox_header_textcol.'">'
          .$lt{'log'}
          .'</h2>';
   
       my $noscript_warning='<noscript><span class="LC_warning"><b>'
                           .&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.')
                           .'</b></span></noscript>';
       my $helpdeskscript;
       my $contactblock = &contactdisplay(\%lt,$servadm,$showadminmail,
                                          $authdomain,\$helpdeskscript,
                                          $showhelpdesk,\@possdoms);
   
       my $mobileargs;
       if ($clientmobile) {
           $mobileargs = 'autocapitalize="off" autocorrect="off"';
       }
       my $loginform=(<<LFORM);
   <form name="client" action="" onsubmit="return(send())">
     <input type="hidden" name="lextkey" value="$lextkey" />
     <input type="hidden" name="uextkey" value="$uextkey" />
     <b><label for="uname">$lt{'un'}</label>:</b><br />
     <input type="text" name="uname" id="uname" size="15" value="$authusername" readonly="readonly" $mobileargs /><br />
     <b><label for="upass$now">$lt{'pw'}</label>:</b><br />
     <input type="password" name="upass$now" id="upass$now" size="15" readonly="readonly" /><br />
     <b><label for="udom">$lt{'dom'}</label>:</b><br />
     <input type="text" name="udom" id="udom" size="15" value="$authdomain" readonly="readonly" $mobileargs /><br />
     <input type="submit" value="$lt{'log'}" />
   </form>
   LFORM
   
       if ($showbanner) {
           $r->print(<<HEADER);
   <!-- The LON-CAPA Header -->
   <div style="background:$pgbg;margin:0;width:100%;">
     <img src="$img" border="0" alt="The Learning Online Network with CAPA" class="LC_maxwidth" />
   </div>
   HEADER
       }
       $r->print(<<ENDTOP);
   <div style="float:left;margin-top:0;">
   <div class="LC_Box" style="background:$loginbox_bg;">
     $logintitle
     $loginform
     $noscript_warning
   </div>
    
   <div class="LC_Box" style="padding-top: 10px;">
     $loginhelp
     $forgotpw
     $contactblock
     $newuserlink
     $coursecatalog
   </div>
   </div>
   
   <div>
   ENDTOP
       if ($showmainlogo) {
           $r->print(' <img src="'.$logo.'" alt="" class="LC_maxwidth" />'."\n");
       }
   $r->print(<<ENDTOP);
   $announcements
   </div>
   <hr style="clear:both;" />
   ENDTOP
       my ($domainrow,$serverrow,$loadrow,$userloadrow,$versionrow);
       $domainrow = <<"END";
         <tr>
          <td  align="left" valign="top">
           <small><b>$lt{'dom'}:&nbsp;</b></small>
          </td>
          <td  align="left" valign="top">
           <small><tt>&nbsp;$domain</tt></small>
          </td>
         </tr>
   END
       $serverrow = <<"END";
         <tr>
          <td  align="left" valign="top">
           <small><b>$lt{'serv'}:&nbsp;</b></small>
          </td>
          <td align="left" valign="top">
           <small><tt>&nbsp;$lonhost ($role)</tt></small>
          </td>
         </tr>
   END
       if ($loadlim) {
           $loadrow = <<"END";
         <tr>
          <td align="left" valign="top">
           <small><b>$lt{'load'}:&nbsp;</b></small>
          </td>
          <td align="left" valign="top">
           <small><tt>&nbsp;$loadpercent $lt{'perc'}</tt></small>
          </td>
         </tr>
   END
       }
       if ($uloadlim) {
           $userloadrow = <<"END";
         <tr>
          <td align="left" valign="top">
           <small><b>$lt{'userload'}:&nbsp;</b></small>
          </td>
          <td align="left" valign="top">
           <small><tt>&nbsp;$userloadpercent $lt{'perc'}</tt></small>
          </td>
         </tr>
   END
       }
       if (($version ne '') && ($version ne '<!-- VERSION -->')) {
           $versionrow = <<"END";
         <tr>
          <td colspan="2" align="left">
           <small>$version</small>
          </td>
         </tr>
   END
       }
   
       $r->print(<<ENDDOCUMENT);
       <div style="float: left;">
        <table border="0" cellspacing="0" cellpadding="0">
   $domainrow
   $serverrow
   $loadrow    
   $userloadrow
   $versionrow
        </table>
       </div>
       <div style="float: right;">
       $domainlogo
       </div>
       <br style="clear:both;" />
    </div>
   
   <script type="text/javascript">
   // <![CDATA[
   // the if prevents the script error if the browser can not handle this
   if ( document.client.uname ) { document.client.uname.focus(); }
   // ]]>
   </script>
   $helpdeskscript
   
   ENDDOCUMENT
       my %endargs = ( 'noredirectlink' => 1, );
       $r->print(&Apache::loncommon::end_page(\%endargs));
       return OK;
   }
   
   sub check_loginvia {
       my ($domain,$lonhost) = @_;
       if ($domain eq '' || $lonhost eq '') {
           return;
       }
       my %domconfhash = &Apache::loncommon::get_domainconf($domain);
       my $loginvia = $domconfhash{$domain.'.login.loginvia_'.$lonhost};
       my $loginvia_exempt = $domconfhash{$domain.'.login.loginvia_exempt_'.$lonhost};
       my $output;
       if ($loginvia ne '') {
           my $noredirect;
           my $ip = $ENV{'REMOTE_ADDR'};
           if ($ip eq '127.0.0.1') {
               $noredirect = 1;
           } else {
               if ($loginvia_exempt ne '') {
                   my @exempt = split(',',$loginvia_exempt);
                   if (grep(/^\Q$ip\E$/,@exempt)) {
                       $noredirect = 1;
                   }
               }
           }
           unless ($noredirect) {
               my ($newhost,$path);
               if ($loginvia =~ /:/) {
                   ($newhost,$path) = split(':',$loginvia);
               } else {
                   $newhost = $loginvia;
               }
               if ($newhost ne $lonhost) {
                   if (&Apache::lonnet::hostname($newhost) ne '') {
                       $output = &redirect_page($newhost,$path);
                   }
               }
           }
       }
       return $output;
   }
   
   sub redirect_page {
       my ($desthost,$path) = @_;
       my $protocol = $Apache::lonnet::protocol{$desthost};
       $protocol = 'http' if ($protocol ne 'https');
       unless ($path =~ m{^/}) {
           $path = '/'.$path;
       }
       my $url = $protocol.'://'.&Apache::lonnet::hostname($desthost).$path;
       if ($env{'form.firsturl'} ne '') {
           $url .='?firsturl='.$env{'form.firsturl'};
       }
       my $start_page = &Apache::loncommon::start_page('Switching Server ...',undef,
                                                       {'redirect' => [0,$url],});
       my $end_page   = &Apache::loncommon::end_page();
       return $start_page.$end_page;
   }
   
   sub contactdisplay {
       my ($lt,$servadm,$showadminmail,$authdomain,$helpdeskscript,$showhelpdesk,
           $possdoms) = @_;
       my $contactblock;
       my $origmail;
       if (ref($possdoms) eq 'ARRAY') {
           if (grep(/^\Q$authdomain\E$/,@{$possdoms})) {
               $origmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
           }
       }
       my $requestmail =
           &Apache::loncommon::build_recipient_list(undef,'helpdeskmail',
                                                    $authdomain,$origmail);
       unless ($showhelpdesk eq '0') {
           if ($requestmail =~ m/[^\@]+\@[^\@]+/) {
               $showhelpdesk = 1;
           } else {
               $showhelpdesk = 0;
           }
       }
       if ($servadm && $showadminmail) {
           $contactblock .= $$lt{'servadm'}.':<br />'.
                            '<tt>'.$servadm.'</tt><br />';
       }
       if ($showhelpdesk) {
           $contactblock .= '<a href="javascript:helpdesk()">'.$lt->{'helpdesk'}.'</a><br />';
           my $thisurl = &escape('/adm/login');
           $$helpdeskscript = <<"ENDSCRIPT";
   <script type="text/javascript">
   // <![CDATA[
   function helpdesk() {
       var possdom = document.client.udom.value;
       var codedom = possdom.replace( new RegExp("[^A-Za-z0-9.\\-]","g"),'');
       if (codedom == '') {
           codedom = "$authdomain";
       }
       var querystr = "origurl=$thisurl&codedom="+codedom;
       document.location.href = "/adm/helpdesk?"+querystr;
       return;
   }
   // ]]>
   </script>
   ENDSCRIPT
       }
       return $contactblock;
   }
   
   sub forgotpwdisplay {
       my (%lt) = @_;
       my $prompt_for_resetpw = 1;
       if ($prompt_for_resetpw) {
           return '<a href="/adm/resetpw">'.$lt{'forgotpw'}.'</a>';
       }
       return;
   }
   
   sub coursecatalog_link {
       my ($linkname) = @_;
       return <<"END";
         <a href="/adm/coursecatalog">$linkname</a>
   END
   }
   
   sub newuser_link {
       my ($linkname) = @_;
       return '<a href="/adm/createaccount">'.$linkname.'</a>';
   }
   
   1;
   __END__

Removed from v.1.121  
changed lines
  Added in v.1.174


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>