"Fossies" - the Fresh Open Source Software Archive

Member "absence-v2.1/cgi-bin/nph-absence-logout.pl.dna" (10 Dec 2013, 1231 Bytes) of package /linux/www/web-absence-2.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/bin/perl
    2 
    3 # $Id: nph-absence-logout.pl 89 2009-07-14 00:12:25Z urban $
    4 
    5 use CGI;
    6 
    7 $CGI::POST_MAX = 300;
    8 $CGI::DISABLE_UPLOADS = 1;
    9 
   10 BEGIN {
   11     if ($ENV{QUERY_STRING} =~ /^instance=(\S+)$/) {
   12         # an instance has been specified
   13         $ENV{INSTANCE_NAME} = $1;
   14         $COOKIE_NAME = "absence-$1";
   15     } else {
   16         $COOKIE_NAME = 'absence';
   17     }
   18 }
   19 
   20 use AbsenceConfig;
   21 my $TOP_PAGE    = AbsenceConfig::fetch('top_page');
   22 my $AUTH_REALM  = AbsenceConfig::fetch('auth_realm');
   23 my $COLOR_MAIN  = AbsenceConfig::fetch('wp_main');
   24 my $VERSION     = '1.1';
   25 
   26 logout();
   27 
   28 #=========================================================================
   29 
   30 sub logout
   31 {
   32     my $q = new CGI;
   33 
   34     print $q->redirect(
   35         -uri    => 'http://www.unix-wissen.de' . $TOP_PAGE,
   36         -nph    => 1,
   37         -www_authenticate   => qq[Digest realm="$AUTH_REALM"],
   38         -status => '401',
   39     );
   40 }
   41 
   42 sub _logout
   43 {
   44     my $q = new CGI;
   45 
   46     print $q->header(
   47         -type               => 'text/html',
   48         -status             => '401 Authorization required',
   49         -expires            => '+3d',
   50         -charset            => 'utf-8',
   51         -nph                => 1,
   52         -www_authenticate   => qq[Digest realm="$AUTH_REALM"],
   53         ),
   54         $q->start_html(
   55             -title  => 'Absence: logged off',
   56             -BGCOLOR => $COLOR_MAIN,
   57             -script => "top.location = '$TOP_PAGE'",
   58         ),
   59         "logged off.",
   60         $q->end_html();
   61 }