navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

Entering validation code at registration

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Entering validation code at registration
Page: [1]
 
slbergh

 

Posts: 322
Joined: 11/8/2002
From: Iowa
Status: offline

 
Entering validation code at registration - 1/13/2007 23:15:48   
I can't seem to get my brain around this one. I'm developing a site where users must have a certain code at registration or they will not be allowed to register. (The code will be provided by their supervisors.) How do I go about checking to see if the code they enter is correct when they submit their registration information to the database?

_____________________________

Digital data lasts forever...or 5 years, whichever comes first!
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Entering validation code at registration - 1/14/2007 12:38:57   
Is the code in the DB already and associated with that user somehow?

If so, it should be just a check to the db and see if there are any records. Are you using the DRW or just ASP?

I generally use a query something like this:

...
passwordCheckQuery = ("SELECT * FROM tblContacts WHERE (ContactEmail = '" & (trim(Request.form("Email")&"")) & "') AND (ContactPassword = '" & (trim(Request.form("Password")&"")) & "')")

set conntemp=server.createobject("adodb.connection")
conntemp.open myDSN
set rstemp=conntemp.execute(passwordCheckQuery)

IF  rstemp.eof THEN
Response.redirectdefault.asp?act=failed")
ELSE
Response.redirectdefault.asp?act=failed")
END IF
...


There is more to that code (DSN's and such) but the query should give you some idea as to how to check for a reg code.

Or am I loosing you?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to slbergh)
slbergh

 

Posts: 322
Joined: 11/8/2002
From: Iowa
Status: offline

 
RE: Entering validation code at registration - 1/14/2007 15:36:53   
The code is in the database, but not associated with the user. Once they register, the code will be associated with them. Here's a brief breakdown:

The site is being developed for multiple locations to access. Each location will have a specific site code associated with it. In order for a user to register, they have to input an authorized site code, which will be provided by their supervisor. The site code is key, since it will determine which database records they have access to.

I was trying to do this with just my very limited ASP skills...right up until I found the DRW add-in for Expression Web.

I think I get what you're saying, though.

_____________________________

Digital data lasts forever...or 5 years, whichever comes first!

(in reply to rdouglass)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Entering validation code at registration - 1/14/2007 18:23:55   
quote:

I think I get what you're saying, though.


What I was thinking wouldn't work for this application tho.

How about a query that checks the reg codes first. If it's in there, return a location code (or whatever). If not, redirect back to registration page?

I'm not real sure of your application but you 'should' be able to grab a location ID and check for valid reg code at the same time that way.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to slbergh)
slbergh

 

Posts: 322
Joined: 11/8/2002
From: Iowa
Status: offline

 
RE: Entering validation code at registration - 1/15/2007 12:49:47   
Okay, so I got past that hump. I (cheated) used code from an ASP generator, which I then hacked away at until it did what I wanted. Now, I'm running into other issues. First, when I register a new user, I get an EOF OR BOF error. In the code, it says that if this error is triggered, record will not be added. However, the new records are writing to the database just fine, so right now I'm suppressing the error. (Not ideal, but it works.)

My next problem is my inability to get a session variable to carry over from page to page. I think I must be missing something. I've tried sending both regular form fields and a hidden field (not at the same time), but it never seems to make it to the next page. My Response.write field is always empty and I'm running out of hair to pull out. :)

_____________________________

Digital data lasts forever...or 5 years, whichever comes first!

(in reply to rdouglass)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Entering validation code at registration - 1/15/2007 12:57:42   
Can you post the code you're using to set and readt the session?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to slbergh)
slbergh

 

Posts: 322
Joined: 11/8/2002
From: Iowa
Status: offline

 
RE: Entering validation code at registration - 1/15/2007 13:20:07   
Here are the 3 files (in 3 posts, of course).

Attachment (1)

_____________________________

Digital data lasts forever...or 5 years, whichever comes first!

(in reply to rdouglass)
slbergh

 

Posts: 322
Joined: 11/8/2002
From: Iowa
Status: offline

 
RE: Entering validation code at registration - 1/15/2007 13:20:46   
Number 2...

Attachment (1)

_____________________________

Digital data lasts forever...or 5 years, whichever comes first!

(in reply to rdouglass)
slbergh

 

Posts: 322
Joined: 11/8/2002
From: Iowa
Status: offline

 
RE: Entering validation code at registration - 1/15/2007 13:21:34   
And number 3.

Attachment (1)

_____________________________

Digital data lasts forever...or 5 years, whichever comes first!

(in reply to slbergh)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Entering validation code at registration - 1/15/2007 13:41:35   

quote:

ORIGINAL: rdouglass

Can you post the code you're using to set and readt the session?


Can you post *just* that code? I would rather not wade thru all the other code since I don't know the full scope of your pages and it'll probably just confuse.


_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to rdouglass)
slbergh

 

Posts: 322
Joined: 11/8/2002
From: Iowa
Status: offline

 
RE: Entering validation code at registration - 1/15/2007 14:21:40   
Sorry!

From the login page:
<form action="login.asp" method="post" onsubmit="return EW_checkMyForm(this);">
	<table border="0" cellspacing="0" cellpadding="4">
	        <tr>
		<td class="form">Email Address</td>
		<td class="form">
		<input type="text" name="username" size="20" value='<%= Request.Cookies(ewProjectName)("username") %>'></td>
	        </tr>
	        <tr>
		<td colspan="2" align="center"><span class="aspmaker">
		<input type="hidden" name="sess" value="<%= username %>"><input type="submit" name="submit" value="Login"></span></td>
	        </tr>
	</table>
</form>


On the redirect page:
<% Session("sess") = Request.Form("sess") 
Response.Write(sess)%>
<%
Response.Redirect "clientslist.asp"  --I comment this out to see if the session is writing
'Response.Redirect "login.asp"
'%>


_____________________________

Digital data lasts forever...or 5 years, whichever comes first!

(in reply to rdouglass)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Entering validation code at registration - 1/15/2007 14:25:34   
quote:

Response.Write(sess)


Response.write(Session("sess"))

That should do it.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to slbergh)
slbergh

 

Posts: 322
Joined: 11/8/2002
From: Iowa
Status: offline

 
RE: Entering validation code at registration - 1/15/2007 15:21:31   
Okay, so there's something in the rest of the code on that page that's causing it to choke. I tried just the response.write with a new form and second page and it worked fine. Time to do some serious digging.

Another related question, though: Once I do finally get it working, how do I pass that same variable to subsequent pages?

_____________________________

Digital data lasts forever...or 5 years, whichever comes first!

(in reply to rdouglass)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Entering validation code at registration - 1/15/2007 15:30:23   
quote:

Once I do finally get it working, how do I pass that same variable to subsequent pages?


AFAIK a session stays alive as long as the browser window remains open.

You can get it on any ASP page by this:

<%=Session("sess")%>

which is exactly the same as:

<%Response.write(Session("sess"))%>

Don't worry about 'passing' it as you would a form field or querystring. It is available at any time on any .ASP page. Since that is a variable you'll probably use throughout the site, it is a good candidate for a session.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to slbergh)
slbergh

 

Posts: 322
Joined: 11/8/2002
From: Iowa
Status: offline

 
RE: Entering validation code at registration - 1/15/2007 15:32:37   
Thanks!

_____________________________

Digital data lasts forever...or 5 years, whichever comes first!

(in reply to rdouglass)
slbergh

 

Posts: 322
Joined: 11/8/2002
From: Iowa
Status: offline

 
RE: Entering validation code at registration - 1/15/2007 16:45:23   
Yay! It works! (Doing a happy dance....)

Here's another question: Can I incorporate the session variable into a database query? For instance, can I select records from sometable where clientEmail = session variable? In case you couldn't tell, this is the first time I've worked with session variables in an application. :)

_____________________________

Digital data lasts forever...or 5 years, whichever comes first!

(in reply to slbergh)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Entering validation code at registration - 1/15/2007 20:03:42   
quote:

select records from sometable where clientEmail = session variable


For a DRW, you'll have to put it on a diet but you should be able to do something like:

fp_sQry="SELECT * FROM myTable WHERE (clientemail ='" & Session("sessionname") & "')"

That help?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to slbergh)
slbergh

 

Posts: 322
Joined: 11/8/2002
From: Iowa
Status: offline

 
RE: Entering validation code at registration - 1/15/2007 20:44:36   
That's working now too. My deepest gratitude...

This has been a bugger of a project so far. It's the first time I've worked without the safety net that is the DRW, the first time I've built a site in EW, the first time I've had to incorporate authentication (2 levels, no less!) and the first time I've tried to do, well, anything using a MySQL database! Talk about a learning experience!!

_____________________________

Digital data lasts forever...or 5 years, whichever comes first!

(in reply to rdouglass)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Entering validation code at registration - 1/15/2007 20:55:06   
quote:

Talk about a learning experience!!


Jump in 'head first'! Woohoo!!! :)

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to slbergh)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Entering validation code at registration
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts