2 Replies - 1437 Views - Last Post: 02 September 2009 - 08:15 AM Rate Topic: -----

#1 pirula   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 26
  • Joined: 26-April 09

Register page problem.

Posted 19 August 2009 - 02:37 PM

I am so confused, I want to add some anti-spam security to my upcoming register page but something is really wrong.
Note that my server is Coldfusion MX7 (i can not afford better) and because of that i can not use
cfimage(captcha).

This is what i have:

<cfset strLowerCaseAlpha = "abcdefghijklmnopqrstuvwxyz">
 
<cfset strUpperCaseAlpha = UCase( strLowerCaseAlpha )>

<cfset strNumbers = "0123456789">
 
<cfset strAllValidChars = (
	strLowerCaseAlpha &
	strUpperCaseAlpha &
	strNumbers
	)>
 
<cfset arrPassword = ArrayNew( 1 )>
 
<cfset arrPassword[ 1 ] = Mid(
	strNumbers,
	RandRange( 1, Len( strNumbers ) ),
	1
	)>
 
<cfset arrPassword[ 2 ] = Mid(
	strLowerCaseAlpha,
	RandRange( 1, Len( strLowerCaseAlpha ) ),
	1
	)>
 
<cfset arrPassword[ 3 ] = Mid(
	strUpperCaseAlpha,
	RandRange( 1, Len( strUpperCaseAlpha ) ),
	1
	)>
 
<cfloop
	index="intChar"
	from="#(ArrayLen( arrPassword ) + 1)#"
	to="8"
	step="1">
 
	<cfset arrPassword[ intChar ] = Mid(
		strAllValidChars,
		RandRange( 1, Len( strAllValidChars ) ),
		1
		)>
 
</cfloop>
 
 
<cfset strPassword = ArrayToList(
	arrPassword,
	""
	)>



<cfif IsDefined("FORM.spamcode")> 
	<cfif form.spamcode neq strPassword >
	<cfset message4 = "not equal.">
	<cfelse>
   <cfmail
	.
	.
	.
	and so on
</cfif>
</cfif>
</cfif>


				 <cfif isdefined ("strPassword")>
				 <cfoutput>#strPassword#</cfoutput>
				 </cfif>





this is just testing code but it is somehow messed up.
every time when i click on the submit button i get message4 (not equal)!
I also need to add when i set up strPassword manualy instead of ArrayToList, for example
<cfset strPassword=test413> and then insert in form test413 and compare it everything is fine.
Any ideas please?

Is This A Good Question/Topic? 0
  • +

Replies To: Register page problem.

#2 pirula   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 26
  • Joined: 26-April 09

Re: Register page problem.

Posted 23 August 2009 - 12:42 AM

I found a solution for my problem! If you need code please let me know i will post it here.
Was This Post Helpful? 0
  • +
  • -

#3 cyb1n   User is offline

  • New D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 27
  • Joined: 08-May 09

Re: Register page problem.

Posted 02 September 2009 - 08:15 AM

View Postpirula, on 22 Aug, 2009 - 11:42 PM, said:

I found a solution for my problem! If you need code please let me know i will post it here.


Glad you were able to solve the issue; I was gonna suggest that your strPassword might be regenerating when you submit the form therefore FORM.spamcode would never be equal. Session variables work great for storing variables that need to remain the same across multiple pages.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1