multipart form processing

R

raj chahal

Hi there

i have created a registration page containing a form than sends username
password to an asp processing page. If the user exists it sends the user
back to the registration page with server.transfer command otherwise it adds
the new user to the database as expected.

Anyhow I now want to add an upload feature to the registration page (using
pure-asp). The example I used says that the form Enctype property should be
set to mulipart/form-data.

Now when I add a new user via the registration form, the processing page for
some reason assumes the user is already registered (BUT IS NOT IN DATABASE)
and the server.transfer code is executed ? sending the user back to the
registration page.

Whats going on here ? and remedies ?

Thanks again.
 
P

Paxton

raj said:
Hi there

i have created a registration page containing a form than sends username
password to an asp processing page. If the user exists it sends the user
back to the registration page with server.transfer command otherwise it adds
the new user to the database as expected.

Anyhow I now want to add an upload feature to the registration page (using
pure-asp). The example I used says that the form Enctype property should be
set to mulipart/form-data.

Now when I add a new user via the registration form, the processing page for
some reason assumes the user is already registered (BUT IS NOT IN DATABASE)
and the server.transfer code is executed ? sending the user back to the
registration page.

Whats going on here ? and remedies ?

Thanks again.

At a guess, it would seem that the revisions you have made to your page
code have resulted in faulty logic. But no one here will be able to
offer concrete help without seeing your code. Post the relevant parts
of it so we don't have to guess.

/P.
 
R

raj chahal

Hi there
I've posted the code hope someone can help.

Here is the code for the form :

<%@LANGUAGE="VBSCRIPT"%>
<html>
<head>
<title>Register</title>
</head>
<body>

<form action="registered.asp" method="post" enctype="multipart/form-data"
name="register">
<table border="0">
<tr>
<td width="103">Username :</td>
<td width="652"><input name="username" type="text" id="username">
</td>
</tr>
<tr>
<td>First Name : </td>
<td width="652"><input name="firstname" type="text" id="firstname"
value="<%=Request.Form("firstname")%>"></td>
</tr>
<tr>
<td>Surname :</td>
<td><input name="surname" type="text"
value="<%=Request.Form("surname")%>"></td>
</tr>
<tr>
<td>Password :</td>
<td><input type="password" name="password"></td>
</tr>
<tr>
<td>Email :</td>
<td><input name="email" type="text"
value="<%=Request.Form("email")%>"></td>
</tr>
<tr>
<td><p>&nbsp;</p> </td>
<td><br>
</td>
</tr>
<tr>
<td colspan="2"><input name="submit" type="submit"
value="submit"></td>
</tr>
</table>
</form>

</body>
</html>

And here is the code for the processing :

<html>
<head>
<title>Registered Routine</title>
</head>
<body>

<%

'bring forward the 4 variables:username, surname, password,email

username=request.form("username")
surname=request.form("surname")
password=request.form("password")
email=request.form("email")

'we would now do a query to see if that registration details are unique, but
we will cover that in a later tutorial

'now to open up the database
%>
<!--#include file="connection.asp"-->
<% ' new raj

'do a loop and check each record for the users, when found set Check to 1
(success)

myquery = "SELECT username,password FROM users"

set query=Conn.execute(myquery)
do while not query.eof

username2=query("username")
password2=query("password")


'if username and password is found in the database together then make check
=1 ie a success

if (username=username2) AND (password=password2) then
'check to see if the user has activated. 0 = not activated,1 = activated

response.write "user exists<br />"

' Response.Redirect("register.asp")
Server.transfer ("register.asp")

end if
set conn = nothing
query.movenext
loop

set query = nothing

' end raj
%>
 
P

Paxton

raj said:
Hi there
I've posted the code hope someone can help.

Here is the code for the form :

<%@LANGUAGE="VBSCRIPT"%>
<html>
<head>
<title>Register</title>
</head>
<body>

<form action="registered.asp" method="post" enctype="multipart/form-data"


You could get rid of enctype="multipart/form-data". It's preventing
the request.form values from being passed to the processing page.
Alternatively, if you are going to add the facility for people to
upload files as part of this script, check the documentation for your
upload component to see how to access them.

'we would now do a query to see if that registration details are unique, but
we will cover that in a later tutorial

!!!!??!! *cough*

/P.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top