在 ColdFusion 中隐藏/加密 URL 变量 [英] Hide/Encrypt URL variables in ColdFusion

查看:14
本文介绍了在 ColdFusion 中隐藏/加密 URL 变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个网站并且 URL 是 www.example.com/mainpage.cfm?id=0123&app=2,我该如何隐藏 id=0123app=2 所以用户将无法更改这些变量?

If I have a website and the URL is www.example.com/mainpage.cfm?id=0123&app=2, how can I hide the id=0123 and app=2 so the user won't be able to change these variables?

我正在查看一个由我之前的人编写的复杂程序,他正在通过 URL 将这些变量从一个页面传递到另一个页面.我只是想快速解决,因为我不想重写整个程序.

I am looking at a complex program written by someone before me and he is passing these variables from page to page through the URL. I am just looking for a quick fix because I don't want to rewrite this entire program.

推荐答案

下面是你的编码方式:

#URLEncodedFormat(Encrypt(id, "#key#"))#

id是变量,key可以是任何东西(作为证书进行编码和解码).

The id is the variable, and the key can be anything (used as a certificate to encode and decode).

解码:

cfset url.id = #Decrypt(url.id, "#key#")#

同样,关键变量将与要编码的变量相同.

Again the key variable would be the same variable as the one to encode.

这篇关于在 ColdFusion 中隐藏/加密 URL 变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆