• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

hash ID from cfmail?

New Here ,
May 20, 2013 May 20, 2013

Copy link to clipboard

Copied

Hi,

i am uisng CF7 and develope the page with  have cfmail send the url to customer but i don't want them to see the ID from the link.  Is there the way to hash, encode, decode for not letting them see an ID but when they click on the link, the ID will propertly decode and retireve the record from the table?

thanks

kt

Views

625

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 20, 2013 May 20, 2013

Copy link to clipboard

Copied

Yes, you could use the Hash function (added in MX7). Since you can't "unhash", you would need to Hash the ID and store the resulting string somewhere. The email to the customer would contain the string as a parameter in the link you send, and when they click the link you compare the value with those you saved.

1) Add a field to your database table containing the IDs, call it something like IDHashed

2) Do a query to get all your ID values and loop over the result

3) cfset ThisHashedString = Hash(current_ID_value, "SHA") and save the result in the field you added, i.e. IDHashed

4) When creating the link to go in the email, use the hashed string as a parameter

5) When someone clicks the link, it goes to your page that sees the parameter, hopefully validates/sanitizes it, and queries your database for a matching value in the field you added in step 1.

I'm all for "if it ain't broke don't fix it", I'm still running CF 9.0.1. But MX7? That's really old....

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 20, 2013 May 20, 2013

Copy link to clipboard

Copied

i guess i can use uuid instead?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 20, 2013 May 20, 2013

Copy link to clipboard

Copied

LATEST

Do you mean use the CreateUUID function? Yes, you could. I'm not sure when that was added, the Livedocs don't say when a function was added, as they do for tags. Whatever works in MX7 should suffice.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation