Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

&remove &subscribe can they be together at last?

Status
Not open for further replies.

Theknonuttinguy

Technical User
Dec 9, 2003
2
CA
$temp=0;
$temp=$ENV{'QUERY_STRING'};
if ($temp) {
$INPUT{'address'} = $temp;
&remove;
}

This a portion of the code that allows my CGI Mail Manager to place a remove link at the bottom of each email.

ie) Click below to be removed immediatly:

If I change the "&remove" to "&subscribe" the above link then becomes an instant subscribe instead of a remove link.

Is there a way to rewrite the above snippet of code to incoorporate both statements?

I am just learning perl/CGI so please speak to the disability and not the man :)

Thank you for your time
 
I do not fully understand.

You want to subscribe AND unsubscribe people in the same click? Or are you looking for one statement that handles both occurances?
 
I am looking for a statement that handles both occurances. I tried a couple of things but...

$temp=0;
$temp=$ENV{'QUERY_STRING'};
if ($temp) {
$INPUT{'address'} = $temp;
&remove;
}
 
Well, given an email address can you determine the status of the address(subscribed or unsubscribed?)?

$temp=0;
$temp=$ENV{'QUERY_STRING'};
if ($temp) {
if(subscribed($temp) ) {
&remove;
} else {
&subscribe;
}
}

where you write a routine named 'subscribed' that checks the status of that address.

If you do not have this knowledge your going to have to use real CGI arguments, not the query string stuff.

In that world

---

use CGI ;

my $query = new CGI ;

my $action = $query->param('action');

if( $action eq "Subscribe" ) { &subscribe($query->param('address') );
} elsif($action eq "Remove" ) {
&remove($query->param('address') ) ;
}

---

You URL would look like

&action=Subscribe&address=me@me.com

 
I think this is what you want to happen - if I click the link and if my email address exists, I'm unsubscribed; otherwise I'm subscribed.

If this is true, you should be ashamed of yourself!

There's always a better way. The fun is trying to find it!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top