[tmp page_title][L]Trying to unsub....[/L][/tmp] [control reset=1] [control-set] [component]product_tree[/component] [/control-set] [control reset=1] @_TOP_@

> ## [msg arg.0="[filter interpolate=1 op=entities][cgi list][/filter]"]Trying to unsub you from the %s list....[/msg]

> [flag type=write table=userdb] [perl userdb] my $db = $Db{userdb}; $Config->{NoSearch} = ''; my $who = $CGI->{who}; my $what = $CGI->{what}; $what =~ s/'/''/; my $s_email = $Tag->filter('entities', $what); $who =~ s/'/''/; my $list = $CGI->{list}; my $s_list = $Tag->filter('entities', $list); my $q = qq{ SELECT username,email,mail_list FROM userdb WHERE username = '$who' AND email = '$what' }; #Debug("unsub query is : $q"); my $ary = $db->query($q); if(! $ary) { $who = $Tag->filter('entities', $who); return "Sorry, error unsubscribing $s_email from list '$s_list'."; } elsif(! scalar(@$ary) ) { return "Sorry, $s_email is not in our database under that user at all."; } my @out; for(@$ary) { my ($uname, $email, $lists) = @$_; my @l = grep /\S/, split /[\s,\0]+/, $lists; my $origlist = join " ", @l; @l = grep $_ ne $list, @l; my $newlist = join " ", @l; if($newlist eq $origlist) { push @out, "Sorry, $s_email is not on the '$s_list' list."; next; } $db->set_field($uname, 'mail_list', $newlist); push @out, "Removed $s_email from $s_list. Thanks for your time."; } return "
> - " . join("
> - ", @out) . "
> "; [/perl]

@_BOTTOM_@