We help IT Professionals succeed at work.

Going to a page without using URL queries...

phantem
phantem asked
on
Hi all,

I've got a large table of items, use, cost, generated by a CF query. when i click on one of them, a new page opens up with details on that item.

something like:
<a href="ItemDetail.cfm?ID=#ID#"Item 1</a>

What I'd like to do is open the detail page while hiding the ID number. -- I don't want people to be able to jump to another item by randomly guessing IDs.

How might I go about doing this?
Comment
Watch Question

Commented:
you can try this:

<form action="ItemDetail.cfm" method="post">
<input type="hidden" id="#id#">
<input type="image" src="images/itemdetailimage.jpg">
or use a submit button
<input type="submit" value="Item Details">
</form>

for each item.

Now in your ItemDetail.cfm you will need to change the code to read FORM.id instead of URL.id

CJ
Commented:
if you want to completely hide ID's I would suggest encrypting them and then passing them via the URL.. if a user tries to edit it.. chances are it wont work.

<a href="ItemDetail.cfm?ID=#Encrypt(ID, "yoursecretkeyword")#">Item 1</a>

Now in ItemDetail.cfm you will do

<cfset decryptedID = Decrypt(URL.ID, "yoursecretkeyword")>
now use decryptedID where you would URL.ID

HTH,
CJ

Author

Commented:
CJ..

it's giving me an error:
decryptedID = Decrypt(URL.ID, "test")

Error resolving parameter URL.ID

??
Chris

Commented:
you are still passing the id via the URL right?

CJ

Author

Commented:
yeah- looks great in URL section of the browser...

just seems to be having trouble with the decrypt function.

Author

Commented:
Ok... figured out that one...
The example I gave you was generalized... my actual URL variable name is 'NameProper' I was using URL.ID. Switched the itemdetail to Decrypt(URL.NameProper, "test") and that error disappeared...

Now, its giving me:

An unexpected system error was detected. (Error code is 20)

This type of error will most likely occur when the server running ColdFusion is low on memory and/or system resources.
If you continue to experience this error in a reproducible fashion you should contact Allaire technical support.

Author

Commented:
Ok... figured out that one...
The example I gave you was generalized... my actual URL variable name is 'NameProper' I was using URL.ID. Switched the itemdetail to Decrypt(URL.NameProper, "test") and that error disappeared...

Now, its giving me:

An unexpected system error was detected. (Error code is 20)

This type of error will most likely occur when the server running ColdFusion is low on memory and/or system resources.
If you continue to experience this error in a reproducible fashion you should contact Allaire technical support.

Commented:
I am not sure about that one.. I have never encountered that error before.. I will see if I can dig something up.

CJ

Author

Commented:
Found the problem... er... found a solution

something to do with URLEncodedFormat...

http://cfhub.com/faq/encrypt.cfm

Works now. thanks for pointing me in the right direction.

Chris

Commented:
aah, missed that one.

glad you got it working.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.