Results 1 to 3 of 3

Thread: How to allow users to unsubscribe?

  1. #1
    Join Date
    Nov 2005

    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?


  2. #2
    Join Date
    Feb 2005
    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
    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.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

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