Jump to content

Delete unsubscribe email addresses


salman_ahad@yahoo.com

Recommended Posts

Well perhaps do this:

<?php
// LINK IN THE E-MAIL: <a href="http://foo.bar/unsubscribe.php?subscription=c98946080b795a6c00e4ec2ab3e18fbe

//$_GET['subscription'] is an md5-hash of the recipient's email (the recipient that wants to  cancel his/her subscription
mysql_query("DELETE FROM `mailinglist_table` WHERE `email_hash`='$_GET['subscription']'");

//For this to work, you have to add another column to your mailing-list table 
//that'll hold the md5-hash (or whatever hash method you choose) of the 
//recipients' email.
?>

 

Keep in mind that:

1) this is a very preliminary way and you will want to sanitize $_GET variables

2) you don't have use a hash in $_GET['subscription'], you could just simply make $_GET['subscription'] hold the email, but it's a little less of a hassle to do it with hashes.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.