Diff -- /var/www/vhosts/3dshawn.com/abforge.3dshawn.com/MODS/ReadSetCookie.pm
Diff

/var/www/vhosts/3dshawn.com/abforge.3dshawn.com/MODS/ReadSetCookie.pm

added on local at 2026-07-01 16:01:34

Added
+47
lines
Removed
-0
lines
Context
0
unchanged
Blobs
from
to 63615b8f4b91
Restore this content →
Unified diff
Naive LCS-based line diff. Additions in emerald, deletions in rose. Both sides decompressed live from BLOB_STORE.
1package MODS::ReadSetCookie;
2
3use strict;
4use CGI;
5my $query = new CGI;
6
7#Load the random alpha numeric code generator
8use MODS::RandCode;
9my $randcode = new MODS::RandCode;
10
11sub new {
12 my($class, %args) = @_;
13 my $self = bless({}, $class);
14
15 return $self;
16}
17
18
19sub read_cookie{
20 my($self, $name) = @_;
21
22 #Read the cookie and look for an existing session that is running
23 my $session = $query->cookie(-name=>"$name");
24 #--------------------------------------------------------------
25
26 return $session;
27}
28
29
30sub set_cookie{
31 my($self, $name) = @_;
32
33 my $session1 = $randcode->generate(20) . time() . $randcode->generate(20);
34 my $session2 = $randcode->generate(20) . time() . $randcode->generate(20);
35 my $session = "$session1" . '---' . "$session2";
36
37 #Set the cookie session since none was found. Domain omitted so the
38 #cookie scopes to whichever vhost served the request (works for
39 #abforge.com, www.abforge.com, and any subdomain on the same host).
40 my $cookie = $query->cookie(-name=>"$name", -value=>"$session", -expires => '+5M', -secure => 1, -httponly => 1, -samesite => 'Lax');
41 print $query->header(-cookie=>$cookie);
42 #--------------------------------------------------------------
43
44 return $session;
45}
46
471;
Keyboard: j next diff k previous diff g top G bottom r restore c compile-check ? help