Diff -- /var/www/vhosts/3dshawn.com/ptmatrix.3dshawn.com/logout.cgi
Diff
/var/www/vhosts/3dshawn.com/ptmatrix.3dshawn.com/logout.cgi
added on local at 2026-07-01 12:34:16
Added
+72
lines
Removed
-0
lines
Context
0
unchanged
Blobs
from
to e89ff0c888c0
to e89ff0c888c0
Unified diff
Naive LCS-based line diff. Additions in emerald, deletions in rose. Both sides decompressed live from BLOB_STORE.| 1 | #!/usr/bin/perl | |
| 2 | ||
| 3 | ################################################################################################################################## | |
| 4 | # ______ ____ ____ ______ ______ ____ ___ __ ___ ______ _ __ ____ ____ __ __ _ __ _____ ____ | |
| 5 | # / ____// __ \ / __ \ / ____/ / ____// __ \ / | / |/ // ____/| | / // __ \ / __ \ / //_/ | | / /|__ / / __ \ | |
| 6 | # / / / / / // / / // __/ / /_ / /_/ // /| | / /|_/ // __/ | | /| / // / / // /_/ // ,< | | / / /_ < / / / / | |
| 7 | # / /___ / /_/ // /_/ // /___ / __/ / _, _// ___ | / / / // /___ | |/ |/ // /_/ // _, _// /| | | |/ / ___/ /_ / /_/ / | |
| 8 | # \____/ \____//_____//_____/ /_/ /_/ |_|/_/ |_|/_/ /_//_____/ |__/|__/ \____//_/ |_|/_/ |_| |___/ /____/(_)\____/ | |
| 9 | # | |
| 10 | # - Written by: Shawn Pickering | |
| 11 | # - shawn@shawnpickering.com | |
| 12 | ################################################################################################################################## | |
| 13 | use strict; | |
| 14 | use lib '/var/www/vhosts/3dshawn.com/ptmatrix.3dshawn.com'; | |
| 15 | ||
| 16 | ||
| 17 | ############################################################# | |
| 18 | ## Variables | |
| 19 | ############################################################# | |
| 20 | ||
| 21 | ||
| 22 | ||
| 23 | ############################################################ | |
| 24 | # Modules | |
| 25 | ############################################################ | |
| 26 | #Load the CGI module | |
| 27 | use CGI; | |
| 28 | my $query = new CGI; | |
| 29 | my $form = $query->Vars; | |
| 30 | ||
| 31 | #Load the login module | |
| 32 | use MODS::Login; | |
| 33 | my $login = new MODS::Login; | |
| 34 | ||
| 35 | #Load Urls | |
| 36 | use MODS::PTMatrix::Urls; | |
| 37 | my $getlist = new MODS::PTMatrix::Urls; | |
| 38 | my $url = $getlist->urls(); | |
| 39 | ||
| 40 | ||
| 41 | ||
| 42 | ############################################################# | |
| 43 | ## Get form data | |
| 44 | ############################################################# | |
| 45 | #Escapes bad characters | |
| 46 | foreach my $line(keys %$form){ | |
| 47 | $form->{$line} =~ s/[^!-~\s]//g; #Remove non ascii chars | |
| 48 | $form->{$line} = quotemeta("$form->{$line}"); | |
| 49 | } | |
| 50 | ||
| 51 | ||
| 52 | ||
| 53 | ############################################################ | |
| 54 | # Program Controls | |
| 55 | ############################################################ | |
| 56 | $|=1; | |
| 57 | my $userinfo = $login->login_verify(); | |
| 58 | &do_logout; | |
| 59 | ||
| 60 | ||
| 61 | ############################################################ | |
| 62 | # Subroutines | |
| 63 | ############################################################ | |
| 64 | sub do_logout{ | |
| 65 | #Tell the login module to invalidate this session (deletes user_sessions row) | |
| 66 | $login->logout_exec($userinfo) if $userinfo; | |
| 67 | ||
| 68 | #Emit the clear-cookie Set-Cookie header BEFORE the redirect status line, | |
| 69 | #so the browser drops the cookie even as it follows the 302. | |
| 70 | print $login->clear_cookie_header(); | |
| 71 | print "Status: 302 Found\nLocation: $url->{index}\n\n"; | |
| 72 | } |