EasyCFM.COM ColdFusion Forums / Coding Help! / Creating a Sign Up page

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: Creating a Sign Up page -- page: 1 2

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

seefor
06-13-2004 @ 12:32 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Junior Member
Posts: 93
Joined: Mar 2004

How can I create a signup page, similiar to this forum.  Not sure were to start.

__________________
Sif aka SeeFor
www.sifizm.com

maquiladoras
06-13-2004 @ 12:57 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 2073
Joined: Dec 2002

erm its incredibly simple

first just create the database with details you want to keep, like name, date of birth, email address etc

so this is what i'd do


Table name = members

Columns -
member_id        - autonumber (identity)
member_firstname - varchar 255
member_lastname  - varchar 255
member_username  - varchar 255
member_password  - varchar 255
member_email     - varchar 255
member_verified  - varchar 50


Ok, so we've set out our table, with a few details such as name, username and password, email and a verified column.

so heres what we do, the sign up form first

signup.cfm
<form action="confirm.cfm" method="post">
Your first Name : <input type="text" name="firstname">
Your last Name  : <input type="text" name="lastname">
Your username   : <input type="text" name="username">
Your Password   : <input type="text" name="password"
Retype password : <input type="text" name="retyped">
Your email      : <input type="text" name="email">
<input type="hidden" name="action" value="signup">
<input type="submit" name="submit">
</form>


Make sure you get them to retype the password so they don't get it wrong.

confirm.cfm
<cfif IsDefined('form.action')>
<CFSET RANDOM = FWKOFEWOFEKW>
<CFQUERY NAME="insertMember" DATASOURCE="myDSN">
   INSERT INTO members (.....)
   VALUES (....)
</CFQUERY>

<CFMAIL ....>
  Dear #form.firstname# #form.lastname#,
  Thankyou for signing up, to confirm that you wish to
  sign up, please click the link, otherwise please
  disregard this mail
  <a href="www.mysite.com/confirm.cfm?id=#random#
</CFMAIL>
<CFELSEIF IsDefined('url.id')>
<CQUERY NAME="isUser" DATASOURCE="myDSN">
   SELECT firstname, lastname
   WHERE member_verified = #url.id
</CFQUERY>
<cfif NOT isUser.Recordcount>
  Unfortunately there was an error signing you up
  if you have already verified your account
  information then you can disregard this message else
  please restart the signup process.
<cfelse>
  Thankyou #firstname# #lastname#,
  You have succesfully completed signing up
</cfif>
</cfif>


OK so basically what we did was firstly after the user signs up we check to see if they submitted via form or clicking a link.

If they did it by the form this means they're signing up, so first we create a random number or code of some such, and insert that into the verified field along with the rest of the details

we then send them an email saying they've been signed up, they just need to confirm the email by clicking the link which has the random number that we just generated

when they click the link it goes back to the confirm page and checks to see if there are any users with the random number that we created

if it did, then this means that it has been verified
after its been verified, reset the random number to a 0 or something so that they cant keep re-registering

thats about it really
not too difficult

-
"There is no justice, There is Just Us"
-

seefor
06-16-2004 @ 10:40 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Junior Member
Posts: 93
Joined: Mar 2004

Sweet will give that a run  Wink


__________________
Sif aka SeeFor
www.sifizm.com

seefor
06-17-2004 @ 12:04 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Junior Member
Posts: 93
Joined: Mar 2004

I know I did something wrong here: Smile

Error Occurred While Processing Request  
Context validation error for tag CFQUERY.  
The end tag </CFQUERY> requires a matching start tag.  
  
The Error Occurred in D:\www\siffer\confirm.cfm: line 25

23 :    SELECT firstname, lastname
24 :    WHERE member_verified = #url.id
25 : </CFQUERY>
26 : <cfif NOT isUser.Recordcount>
27 :   Unfortunately there was an error signing you up



<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<cfif IsDefined('form.action')>
<CFSET RANDOM = FWKOFEWOFEKW>
<cfquery name="insertMember2" datasource="siffer">
     INSERT INTO g_members (member_firstname, member_lastname, member_username, member_password, member_email)
     VALUES (#FORM.firstname#, #FORM.lastname#, #FORM.username#, #FORM.password#, #FORM.email#)
</cfquery>
<cfmail query="insertMember2" to="#form.email#" from="Siffer">
  Dear #form.firstname# #form.lastname#,
  Thankyou for signing up, to confirm that you wish to
  sign up, please click the link, otherwise please
  disregard this mail
  <a href="localhost/confirm.cfm?id=#random#">Please Click Here To Confirm</a>
</CFMAIL>
<CFELSEIF IsDefined('url.id')>
<CQUERY NAME="isUser" DATASOURCE="siffer">
   SELECT firstname, lastname
   WHERE member_verified = #url.id
</CFQUERY>
<cfif NOT isUser.Recordcount>
  Unfortunately there was an error signing you up
  if you have already verified your account
  information then you can disregard this message else
  please restart the signup process.
<cfelse>
  Thankyou #firstname# #lastname#,
  You have succesfully completed signing up
</cfif>
</cfif>
</body>
</html>


__________________
Sif aka SeeFor
www.sifizm.com

maquiladoras
06-17-2004 @ 5:44 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 2073
Joined: Dec 2002

ive not looked the query over fully
but im absolutely sure its this
WHERE member_verified = #url.id

you're missing a #

-
"There is no justice, There is Just Us"
-

seefor
06-17-2004 @ 3:11 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Junior Member
Posts: 93
Joined: Mar 2004

Fixed that then I got another Error
Variable FWKOFEWOFEKW is undefined.  

  
The Error Occurred in D:\www\siffer\confirm.cfm: line 9

7 : <body>
8 : <cfif IsDefined('form.action')>
9 : <CFSET RANDOM = FWKOFEWOFEKW>
10 : <cfquery name="insertMember2" datasource="siffer">
11 :      INSERT INTO g_members (member_firstname, member_lastname, member_username, member_password, member_email, member_verified)


Is that becasue I need to create a random number or shomething??

Here is the code:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<cfif IsDefined('form.action')>
<CFSET RANDOM = FWKOFEWOFEKW>
<cfquery name="insertMember2" datasource="siffer">
     INSERT INTO g_members (member_firstname, member_lastname, member_username, member_password, member_email, member_verified)
     VALUES (#FORM.firstname#, #FORM.lastname#, #FORM.username#, #FORM.password#, #FORM.email#, #random#)
</cfquery>
<cfmail query="insertMember2" to="#form.email#" from="Siffer" subject="This is a test">
  Dear #form.firstname# #form.lastname#,
  Thankyou for signing up, to confirm that you wish to
  sign up, please click the link, otherwise please
  disregard this mail
  <a href="localhost/confirm.cfm?id=#random#">Please Click Here To Confirm</a>
</CFMAIL>
<CFELSEIF IsDefined('url.id')>
<CFQUERY NAME="isUser" DATASOURCE="siffer">
   SELECT firstname, lastname
   WHERE member_verified = #url.id#
</CFQUERY>
<cfif NOT isUser.Recordcount>
  Unfortunately there was an error signing you up
  if you have already verified your account
  information then you can disregard this message else
  please restart the signup process.
<cfelse>
  Thankyou #firstname# #lastname#,
  You have succesfully completed signing up
</cfif>
</cfif>
</body>
</html>


__________________
Sif aka SeeFor
www.sifizm.com

maquiladoras
06-17-2004 @ 3:23 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 2073
Joined: Dec 2002

ok, well the thing is you're going to want to set a random password, my bad in that was that strings should be surrounded by qoutation marks

so

<cfset thing = "hello">
will set it as a text var, so you do
#thing# it will print hello

if you do
<cfset thing = hello>
it will look for a var named hello, so if you did
<cfset hello = "hello world!">
<cfset thing = hello>

doing #thing# will give you Hello World!
but if you don't have Hello defined in some way shape or form it will give you the undefined

but as for the random one, you're going to want to include some way to randomly set the auth code

maybe something like

<CFSET RANDOM  = "auth#RandRange(1,10000)#">

-
"There is no justice, There is Just Us"
-

seefor
06-17-2004 @ 6:05 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Junior Member
Posts: 93
Joined: Mar 2004

I got that now I get this error message Smile

Error Occurred While Processing Request  
Error Executing Database Query.  
[MERANT][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'member_lastname. member_verified WHERE 'member_verified' = FWKOFEWOFEKW'.  
  
The Error Occurred in D:\www\siffer\confirm.cfm: line 13

11 :
12 : <body>
13 : <cfif IsDefined('form.action')>
14 : <CFSET RANDOM = "FWKOFEWOFEKW">
15 : <cfquery name="insertMember2" datasource="siffer">



--------------------------------------------------------------------------------

SQL    SELECT member_firstname, member_lastname. member_verified WHERE 'member_verified' = FWKOFEWOFEKW




<CFQUERY NAME="isUser" DATASOURCE="siffer">
   SELECT member_firstname, member_lastname. member_verified
   WHERE 'member_verified' = #url.id#
</CFQUERY><html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<cfif IsDefined('form.action')>
<CFSET RANDOM  = "auth#RandRange(1,10000)#">
<cfquery name="insertMember2" datasource="siffer">
     INSERT INTO g_members (member_firstname, member_lastname, member_username, member_password, member_email, member_verified)
     VALUES ('#FORM.firstname#', '#FORM.lastname#', '#FORM.username#', '#FORM.password#', '#FORM.email#', '#random#')
</cfquery>
<cfmail to='#form.email#' from="sif@sifizm.com" subject="This is a test from Sif" type="html">
  Dear #form.firstname# #form.lastname#,
  Thankyou for signing up, to confirm that you wish to
  sign up, please click the link, otherwise please
  disregard this mail
  <a href="http://localhost/siffer/confirm.cfm?id=#random#">Please Click Here To Confirm</a>
</CFMAIL>
<CFELSEIF IsDefined('url.id')>
<CFQUERY NAME="isUser" DATASOURCE="siffer">
   SELECT member_firstname, member_lastname. member_verified
   WHERE 'member_verified' = #url.id#
</CFQUERY>
<cfif NOT isUser.Recordcount>
  Unfortunately there was an error signing you up
  if you have already verified your account
  information then you can disregard this message else
  please restart the signup process.
<cfelse>
  Thankyou #firstname# #lastname#,
  You have succesfully completed signing up
</cfif>
</cfif>
</body>
</html>

PS Thanks so much for your help
__________________
Sif aka SeeFor
www.sifizm.com

This message was edited by seefor on 6-17-04 @ 6:06 PM

maquiladoras
06-17-2004 @ 6:20 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 2073
Joined: Dec 2002

<CFQUERY NAME="isUser" DATASOURCE="siffer">
   SELECT member_firstname, member_lastname. member_verified
   WHERE 'member_verified' = #url.id#
</CFQUERY><

change to

<CFQUERY NAME="isUser" DATASOURCE="siffer">
SELECT member_firstname, member_lastname, member_verified
WHERE member_verified = '#url.id#'
</CFQUERY>

-
"There is no justice, There is Just Us"
-

seefor
06-17-2004 @ 6:48 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Junior Member
Posts: 93
Joined: Mar 2004

WOooooooow I got it to work now.

Another Question I change te member_verfied to 0 once you confirm your email.  Now, how can I stop the user from register again with the same email address?

<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<cfif IsDefined('form.action')>
<CFSET RANDOM  = "auth#RandRange(1,10000)#">
<cfquery name="insertMember2" datasource="siffer">
     INSERT INTO g_members (member_firstname, member_lastname, member_username, member_password, member_email, member_verified)
     VALUES ('#FORM.firstname#', '#FORM.lastname#', '#FORM.username#', '#FORM.password#', '#FORM.email#', '#random#')
</cfquery>
<cfmail to='#form.email#' from="sif@sifizm.com" subject="This is a test from Sif" type="html">
  Dear #form.firstname# #form.lastname#,
  Thankyou for signing up, to confirm that you wish to
  sign up, please click the link, otherwise please
  disregard this mail
  <a href="http://localhost/siffer/confirm.cfm?id=#random#">Please Click Here To Confirm</a>
</CFMAIL>
<CFELSEIF IsDefined('url.id')>
<CFQUERY NAME="isUser" DATASOURCE="siffer">
SELECT member_firstname, member_lastname, member_verified FROM g_members
WHERE member_verified = '#url.id#'
</CFQUERY>
<cfif NOT isUser.Recordcount>
  Unfortunately there was an error signing you up
  if you have already verified your account
  information then you can disregard this message else
  please restart the signup process.
<cfelse>
<cfquery datasource="siffer">
UPDATE g_members SET
member_verified = '0'
  </cfquery>
  Thank you #firstname# #lastname#,
  You have succesfully completed signing up
</cfif>
</cfif>
</body>
</html>


__________________
Sif aka SeeFor
www.sifizm.com

PAGE: 1 2

Website Designed and Developed by Pablo Varando.