Gossamer Forum
Quote Reply
Write Cookies
Hi,

I want to overwrite an existing cookie when someone logs out from the forum. I try to use a plugin with a hook after "logout".

The following isn't working.

Code:
package Plugins::GForum::CookieOut;
# ==================================================================

use strict;
use GT::Base;
use GT::Plugins qw/STOP CONTINUE/;
use GForum qw/$IN $DB $CFG/;
use GT::CGI;
use GT::CGI::Cookie;

# Inherit from base class for debug and error methods
@Plugins::GForum::CookieOut::ISA = qw(GT::Base);

# Your code begins here! Good Luck!


# PLUGIN HOOKS
# ===================================================================


sub loeschen {
# -------------------------------------------------------------------
# This subroutine will get called whenever the hook 'logout'
# is run. You should call GT::Plugins->action ( STOP ) if you don't
# want the regular code to run, otherwise the code will continue as
# normal.
#
my (@args) = @_;

# Do something useful here

my $in = new GT::CGI;

my $c = new CGI::Cookie(-name => 'lh_username', -value => '');
print $in->header( -cookie => $c );

return @args;
}

# Always end with a 1.
1;

Can someone give me a hint?


This from the forum-help doesn't worked at all:

------------------
To set a cookie:

$c = $cgi->cookie (-name => 'foo', -value => 'bar')

You would then set the cookie by passing it to the header function:

print $in->header ( -cookie => $c );
--------------------
Subject Author Views Date
Thread Write Cookies petersenj 3262 Apr 2, 2003, 2:05 PM
Thread Re: [petersenj] Write Cookies
Paul 3131 Apr 2, 2003, 2:55 PM
Thread Re: [Paul] Write Cookies
jmar 3088 Apr 3, 2003, 11:57 PM
Post Re: [jmar] Write Cookies
Paul 3086 Apr 4, 2003, 12:27 AM