This a follow-up question to thread232-1266217.
I am doing something similar for a client. I don't want to show the dynamic ID in the URL string, so I am doing an encrypt() on the page with the link, and a decrypt() on the page showing the details.
please note: that I have this working. I only need help trying to detect if the user manipulated the URL string
This is how I have set-up:
On PAGE2.CFM, I do something like this:
<cfif isdefined("#URL.LID#") and URL.LID NEQ "">
<cfquery name="" datasource="">
</cfquery>
<cfelse>
OOOPPPPPPSSSS!!
</cfif>
What I'd also like to do is have another check to see if the user changed the #URL.LID# value, if the user did redirect them to main page. How can I do that?
As it stands, if i change the value in LID, I get this error message:
There has been an error while trying to encrypt or decrypt your input string: Given final block not properly padded.
The reason I get that error is because "key" on first page is not same as "key" on display page. Is there a way to have another check for this? Or, am I just wasting my time?
____________________________________
Just Imagine.
I am doing something similar for a client. I don't want to show the dynamic ID in the URL string, so I am doing an encrypt() on the page with the link, and a decrypt() on the page showing the details.
please note: that I have this working. I only need help trying to detect if the user manipulated the URL string
This is how I have set-up:
Code:
[b]APPLICATION.CFM[/b]
<cfset VARIABLES.algorithm = "AES">
<cfset VARIABLES.encoding = "hex">
<cfset VARIABLES.key = GenerateSecretKey(VARIABLES.algorithm)>
<cfset REQUEST.phrase = "454d5a4daSAASSDASD==_+Dada">
[COLOR=blue]I outputted VARIABLES.key to get the value which I hardcode for REQUEST.phrase. I then pass REQUEST.phrase in place of the "key" attribute in encrypt/decrypt. I am doing it this way because of an issue noted here: [URL unfurl="true"]http://forums.hostmysite.com/about4161.html[/URL][/color]
[b]PAGE1.CFM[/b]
<cfset VARIABLES.enc = Encrypt('#query.MAIN_ID#', REQUEST.phrase, VARIABLES.algorithm, VARIABLES.encoding)>
<pre>#REQUEST.phrase#</pre>
<a href="page2.cfm?LID=#VARIABLES.enc#">view</a>
[b]PAGE2.CFM[/b]
<cfset dec = Decrypt('#URL.LID#', REQUEST.phrase, VARIABLES.algorithm, VARIABLES.encoding)>
On PAGE2.CFM, I do something like this:
<cfif isdefined("#URL.LID#") and URL.LID NEQ "">
<cfquery name="" datasource="">
</cfquery>
<cfelse>
OOOPPPPPPSSSS!!
</cfif>
What I'd also like to do is have another check to see if the user changed the #URL.LID# value, if the user did redirect them to main page. How can I do that?
As it stands, if i change the value in LID, I get this error message:
There has been an error while trying to encrypt or decrypt your input string: Given final block not properly padded.
The reason I get that error is because "key" on first page is not same as "key" on display page. Is there a way to have another check for this? Or, am I just wasting my time?
____________________________________
Just Imagine.