Diff -- /var/www/vhosts/3dshawn.com/repricer.3dshawn.com/_attic/buyer_logout.cgi
Diff

/var/www/vhosts/3dshawn.com/repricer.3dshawn.com/_attic/buyer_logout.cgi

added on local at 2026-07-01 21:47:31

Added
+38
lines
Removed
-0
lines
Context
0
unchanged
Blobs
from
to 2964ec50c84f
Restore this content →
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# RePricer -- buyer logout.
4#
5# Revokes the buyer's session row and clears the cookie. Always 302s
6# back to the storefront (so a logged-out buyer lands on the public
7# product list, not a 404).
8#======================================================================
9use strict;
10use warnings;
11
12use lib '/var/www/vhosts/3dshawn.com/repricer.3dshawn.com';
13use CGI;
14use MODS::DBConnect;
15use MODS::RePricer::Config;
16use MODS::RePricer::BuyerAuth;
17
18my $q = CGI->new;
19my $form = $q->Vars;
20my $db = MODS::DBConnect->new;
21my $cfg = MODS::RePricer::Config->new;
22my $auth = MODS::RePricer::BuyerAuth->new;
23my $DB = $cfg->settings('database_name');
24
25$| = 1;
26
27my $sid = $form->{id} || $form->{storefront_id} || 0;
28$sid =~ s/[^0-9]//g;
29
30my $dbh = $db->db_connect();
31my $buyer = $auth->verify($q, $db, $dbh, $DB);
32my $cookie = $auth->logout($db, $dbh, $DB, $buyer ? $buyer->{session_id} : '');
33$db->db_disconnect($dbh);
34
35my $back = $sid ? "/store.cgi?id=$sid" : '/';
36print "Status: 302 Found\n";
37print "Set-Cookie: $cookie\n";
38print "Location: $back\n\n";
Keyboard: j next diff k previous diff g top G bottom r restore c compile-check ? help