Re: multipart form processing
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> </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
%>
"raj chahal" <info@digitise.info> wrote in message
news:%23RjVIXUOGHA.2472@TK2MSFTNGP11.phx.gbl...[color=blue]
> 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[/color]
adds[color=blue]
> 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[/color]
be[color=blue]
> set to mulipart/form-data.
>
> Now when I add a new user via the registration form, the processing page[/color]
for[color=blue]
> some reason assumes the user is already registered (BUT IS NOT IN[/color]
DATABASE)[color=blue]
> and the server.transfer code is executed ? sending the user back to the
> registration page.
>
> Whats going on here ? and remedies ?
>
> Thanks again.
>
>[/color]
|