Deekman
12-08-2005, 06:58 AM
Hi guys I've been beeting my head against the wall over this for the last 16 hours. Only a small error but nothing I try seems to be working.
I'm trying to create an admin log in form that takes the variables from a sign in form. Scrambles the password, checks both the username and the password against the database and if they're both correct signs me in and adds the username and IDNumber of the user to a session, if they're wrong (the username or password) it kicks me back to the login page and activates a variable that causes red text to pop up on the window.
Now the problem is that it all works except the error handling, it takes the password, it scrambles it, if everything's right then it goes through it's fine. If the details are wrong however instead of doing a Response.Redirect it gives me a Server 500 error.
Here's the code of my verifier (might aswell distribute it since it's just something meant for a project nothing important).
As I said everything works fine except redirecting (the if statement down the end) me if there's an error. Any one have any ideas?
<% @language = vbscript %>
<!--#include file="dbconn.inc" -->
<%
if request("TheUsername") = "" OR request("ThePass") = "" then
response.redirect "index.asp?info=wrong"
end if
%>
<%
Dim UNEncryptPassword, vEncryptPassword(), Letter
UNEncryptPassword = UCase(Request.Form("ThePass"))
Redim Preserve vEncryptPassword( Len(UNEncryptPassword) )
for Letter = 1 to Len(UNEncryptPassword)
vEncryptPassword( Letter ) = Mid( UNEncryptPassword, Letter, 1 )
next
Dim ASCLetter, vASCPassword(), ScrambledPassword
Redim vASCPassword( UBound(vEncryptPassword) )
for Letter = 1 to UBound(vEncryptPassword)
ASCLetter = ASC(vEncryptPassword(Letter))
vASCPassword(Letter) = Chr(ASCLetter + 3)
next
ScrambledPassword = Join(vASCPassword)
%>
<%
querystring = "SELECT * FROM users WHERE Username='" & request("TheUsername") & "' AND Password='" & (ScrambledPassword) & "'"
Set RS = conn.execute(querystring)
username=request("TheUsername")
password=(ScrambledPassword)
IDNumber=RS("ID")
if not RS.EOF then
SESSION("Username")= username
SESSION("IDNumber")= IDNumber
Response.Redirect("admin.asp")
else
Response.Redirect ("index.asp?info=wrong")
end if
%>
I'm trying to create an admin log in form that takes the variables from a sign in form. Scrambles the password, checks both the username and the password against the database and if they're both correct signs me in and adds the username and IDNumber of the user to a session, if they're wrong (the username or password) it kicks me back to the login page and activates a variable that causes red text to pop up on the window.
Now the problem is that it all works except the error handling, it takes the password, it scrambles it, if everything's right then it goes through it's fine. If the details are wrong however instead of doing a Response.Redirect it gives me a Server 500 error.
Here's the code of my verifier (might aswell distribute it since it's just something meant for a project nothing important).
As I said everything works fine except redirecting (the if statement down the end) me if there's an error. Any one have any ideas?
<% @language = vbscript %>
<!--#include file="dbconn.inc" -->
<%
if request("TheUsername") = "" OR request("ThePass") = "" then
response.redirect "index.asp?info=wrong"
end if
%>
<%
Dim UNEncryptPassword, vEncryptPassword(), Letter
UNEncryptPassword = UCase(Request.Form("ThePass"))
Redim Preserve vEncryptPassword( Len(UNEncryptPassword) )
for Letter = 1 to Len(UNEncryptPassword)
vEncryptPassword( Letter ) = Mid( UNEncryptPassword, Letter, 1 )
next
Dim ASCLetter, vASCPassword(), ScrambledPassword
Redim vASCPassword( UBound(vEncryptPassword) )
for Letter = 1 to UBound(vEncryptPassword)
ASCLetter = ASC(vEncryptPassword(Letter))
vASCPassword(Letter) = Chr(ASCLetter + 3)
next
ScrambledPassword = Join(vASCPassword)
%>
<%
querystring = "SELECT * FROM users WHERE Username='" & request("TheUsername") & "' AND Password='" & (ScrambledPassword) & "'"
Set RS = conn.execute(querystring)
username=request("TheUsername")
password=(ScrambledPassword)
IDNumber=RS("ID")
if not RS.EOF then
SESSION("Username")= username
SESSION("IDNumber")= IDNumber
Response.Redirect("admin.asp")
else
Response.Redirect ("index.asp?info=wrong")
end if
%>