At 09:37 PM 8/3/2004, Scott Haneda wrote:
I am building a mailing list manager, using mysql 4 at the moment.  I want
to have a simply web interface where one can remove themselves from a
mailing list. This will most likely be supplied as a link in a email that
will be sent to them when they email in and request info about a mailing
list.  What I don't want is to have a link like [EMAIL PROTECTED]
but would rather mask that email address as a unique string.

I was thiking that on INSERT I can use a timestamp with some random and that
should be pretty much guaranteed to be unique, I could just use the PK but
then people could fiddle the url and mess with others accounts.  So I need
something non sequential, rather random looking at least, perhaps somehow
make mysql case sensitive on this one as well. (How does one make mysql case
senseitive on a field?)

Would MD5(user_email_address) pretty much be what I am after?

yes


I don't suppose there is any way to "un-MD5" something?

There better not be.<g> MD5 generates a 32 character string and you can't MD5 a 5000 character string into a 32 character string, and then unMD5 it back to a 5000 character string. MD5 generates a one way hash.


All you need to do is add another column to your table call it "hash_user_email_address" and when the row is stored, do the MD5(user_email_address) to get this column value. Make sure this hash column is indexed. Then on the web interface use this hash_user_email_address value in the HREF link so when the user clicks on it, the 32 character string gets sent to your webserver and all it has to do is look it up into the table to get the correct row using something like:

update user_table set active_subscription=0 where hash_user_email_address = "44DA8341..12333"

to turn the subscription off. Of course you would also use an email verification with a hyperlink with something similar to turn it on initially when the user first subscribes.

BTW, the user_email_address should be unique otherwise you could have collisions with the hash values.

Mike

--
-------------------------------------------------------------
Scott Haneda                                Tel: 415.898.2602
http://www.newgeo.com                       Fax: 313.557.5052
[EMAIL PROTECTED]                            Novato, CA U.S.A.



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to