Results 1 to 7 of 7

Thread: Unsubscribe Link

  1. #1
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default Unsubscribe Link

    Wondering how to this, after subscribing to a newsletter - I need some way to authenticate what the user's email is and then delete them from the database, anyone know a way to do this?

    Somehow taking their email address from the page they last visited?

    Thanks,

    Jack.

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Yeah are you trying to make a mailing list? I made a simple thing you can go through of here: http://www.dynamicdrive.com/forums/s...ad.php?t=40161 If you dont want the whole thing the leave.php (i think) has how to remove one email address might need a few modifications but that basics.

  3. #3
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    Ah right, that's a nice compilation, but using this method means anyone can delete any other person's email from the list doesn't it? Or am I wrong?

    Edit: Maybe it could be done with cookies that hold the unique id of the person... but people can still delete them =/

  4. #4
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Well yea but I find the chances are really low though that someone would try to find the proper username and domain to get someone off a mailing list from a specific domain. You could set up an additional parameter like a unique ID with each that attaches after the username and is removed before it sends. So it would only be on when they join or want to leave. You'd have to send them an email to let them know that ID though or you could try your cookie idea as well but I don't know how to do that one.

  5. #5
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    Yea, well with the cookie it would work with the same ID sort of thing and when they unsubscribe the PHP looks at the ID in the cookie and then gets the corresponding email, just cookies can be deleted at any time so it isn't exactly fool proof.

    Edit: Probably just easiest to go with the simple way, I mean you've got to be pretty bored if you're going to try and guess emails that are on the list already.

    Not like it's a big company either.

  6. #6
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    This is only an idea I haven't test this and you'd need to remake the join form to get passwords and write that with the username to another text file where they are joined together...
    (this is not a secure method at all however. You should randomize the text file name and not allow directory listings)
    PHP Code:
    $username $_POST['leavethepageemail'];
    $password $_POST['password'];
    $myotherfile "SSeCuRe@976535.txt";
    $fh fopen($myotherfile'r');
    $securedata fread($fh20000000);
    fclose($fh);
    $getout =  str_replace($username $password""$myotherfile);
    $checkthat =  str_replace($username  ""$myotherfile);
    $checkthis =  str_replace($password  ""$myotherfile);
    if (
    $checkthat $checkthis == $getout) {
    $leaving $username;
    $myfile "addresses.txt";
    $fh fopen($myfile'r');
    $thedata fread($fh20000000);
    fclose($fh);
    $leaving $leaving ', ';
    $olddate $thedata;
    $remove str_replace('Bcc: ' $leaving""$thedata);
    $file "addresses.txt";
    $newdata $thedata;
    $handle fopen($file'w');
    fwrite($handle$remove);
    fclose($handle);
    if (
    $olddata <> $newdata) {
    die (
    'You have successfully been removed from the mailing list.</body></html>');

    else 
    {
    die (
    'There was an error removing your email address from the mailing list please re-enter your email address. If the problem continues please contact the adminastrator.</body></html>');
    }
    }
    else 
    {
    die (
    'Your username or password were not found please try again.');

    Oh you'd also want to write it so the username and password leave the secure text file as well

  7. #7
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    Thanks for that, but I think I'm going to just stick with the bog standard newsletter system

Bookmarks

Posting Permissions

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