{
    my $status = $bandwidthd{'status'} || "disabled";
    return "    # bandwidthd is disabled in this VirtualHost"
           unless $status eq 'enabled';

   $OUT = "";
   my $pass = 0;
   my $allow = $localAccess;
   my $satisfy = 'all';
   my $name = $bandwidthd{'Name'} || 'Application bandwidthd Login';
   my $webinterface =  $bandwidthd{'webinterface'} || 'both';

   for ('exit-if-none')
   {
     if ($bandwidthd{'webaccess'})
     {
         if ($bandwidthd{'webaccess'} eq 'private')
         {
           $allow   = $localAccess;
           $satisfy = 'all';
	   $pass = 1;
         }
         elsif ($bandwidthd{'webaccess'} eq 'local')
         {
           $allow   = $localAccess;
           $satisfy = 'all';
	   $pass = 0;
         }
          elsif ($bandwidthd{'webaccess'} eq 'public')
         {
           $allow   = 'all';
           $satisfy = 'all';
	   $pass = 1;
         }
         elsif ($bandwidthd{'webaccess'} eq 'global')
         {
           $allow   = 'all';
           $satisfy = 'all';
	   $pass = 0;
         }
     }
 if ($webinterface eq "both" || $webinterface  eq "html")
     {  
      $OUT .= "#------------------------------------------------------------\n";
      $OUT .= "# bandwidthd HTML- $name\n";
      $OUT .= "#------------------------------------------------------------\n";
      
      
      if (exists $bandwidthd{'URL'} && $webinterface  eq "html")
        { $OUT .= "Alias  /$bandwidthd{'URL'}  /var/www/bandwidthd/htdocs\n"; }
      
      
      if ( $webinterface  eq "html")
        {
        $OUT .= "Alias  /bandwidthd  /var/www/bandwidthd/htdocs\n";
        }
        $OUT .= "Alias  /bandwidthd-static  /var/www/bandwidthd/htdocs\n";
      
      $OUT .= "\n";
      $OUT .= "<Directory /var/www/bandwidthd/htdocs>\n";
      $OUT .= "    AddType application/x-httpd-php .php .conf\n";
      $OUT .= "    php_admin_value open_basedir /var/www/bandwidthd/htdocs\n";
      $OUT .= "    SSLRequireSSL\n";
      $OUT .= "    Options None\n";
      $OUT .= "    order deny,allow\n";
      $OUT .= "    deny from all\n";
      $OUT .= "    allow from $allow\n";
      if ($pass)
      {
          $OUT .= "    AuthName \"$name\"\n";
    $OUT .= "    AuthBasicProvider external\n";
          $OUT .= "    AuthType Basic\n";
          $OUT .= "    AuthExternal pwauth\n";
          $OUT .= "    require user admin\n";
          $OUT .= "    Satisfy $satisfy\n";
      }
      $OUT .= "</Directory>\n";
     }

 if ($webinterface eq "both" || $webinterface  eq "php")
     {
      $OUT .= "#------------------------------------------------------------\n";
      $OUT .= "# bandwidthd PHP- $name\n";
      $OUT .= "#------------------------------------------------------------\n";
 
      
      if (exists $bandwidthd{'URL'} && $webinterface  ne "html" )
        { $OUT .= "Alias  /$bandwidthd{'URL'}  /var/www/bandwidthd/phphtdocs\n"; }
     
 
      $OUT .= "Alias  /bandwidthd  /var/www/bandwidthd/phphtdocs\n";
 
      $OUT .= "Alias  /bandwidthd-sql  /var/www/bandwidthd/phphtdocs\n";

      $OUT .= "\n";
      $OUT .= "<Directory /var/www/bandwidthd/phphtdocs>\n";
      $OUT .= "    AddType application/x-httpd-php .php .conf\n";
      $OUT .= "    php_admin_value open_basedir /var/www/bandwidthd/phphtdocs\n";
      $OUT .= "    SSLRequireSSL\n";
      $OUT .= "    Options None\n";
      $OUT .= "    order deny,allow\n";
      $OUT .= "    deny from all\n";
      $OUT .= "    allow from $allow\n";
      if ($pass)
      {
          $OUT .= "    AuthName \"$name\"\n";
    $OUT .= "    AuthBasicProvider external\n";
          $OUT .= "    AuthType Basic\n";
          $OUT .= "    AuthExternal pwauth\n";
          $OUT .= "    require user admin\n";
          $OUT .= "    Satisfy $satisfy\n";
      }
      $OUT .= "</Directory>\n";
    }
  }

}
