www.webdeveloper.com
Results 1 to 3 of 3

Thread: How to allow users to unsubscribe?

  1. #1
    Join Date
    Nov 2005
    Posts
    1

    How to allow users to unsubscribe?

    Hi guys,

    I set cron job to run php file that send latest update to my subscribers daily.

    The question is, how do I add an extra link in the emails which allow my subscribers to stop receiving this daily update?

    Regards

  2. #2
    Join Date
    Feb 2005
    Location
    Tauranga
    Posts
    2,062
    i would set another feild in your database in this case we will say "subscribed" with a default of "yes".

    the link could point them to a page where they enter in their username and email or something, then using that info change the yes to no, and whe you pull the email address to send the daily email

    PHP Code:
    "SELECT email FROM users WHERE subscribed = yes"
    makes sence to me, do you follow?

  3. #3
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,157
    If each email is sent separately to each subscriber, then the link can be created dynamically for each email and would include a value in the URL which would specify the specific user, something like http://www.yoursite.com/unsubscribe.php?id=1234567. Then if the user clicks the unsusbscribe link, the script called by that link would grab that identifier from the GET data to be used in the unsubscribe action (likely a query that toggles a "subscribe" flag in the user database. For better security, you might generate a second string to include in the URL, maybe a md5() of the user name or something, and add that as a second URL value to be checked when the users clicks the link. That could help prevent malicious users from requesting the unsubscribe link with random id values.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles