peaceful
11-25-2002, 01:38 PM
Hi there,
I'm pretty new to this programming lark (although I used to make my Amstrad CPC464 draw houses in basic ;)
With a little help from ASP for dummies, i've managed to write a login system - it checks against an access database for username and password, and then redirects the users to the page appropriate to their level of access within the organisation I work for (a national education charity in the UK)...So far, so extrememly exciting (for me at least :)
However, for some bizzare reason, the part of the code which, having accertained their level of access is then supposed to write a cookie, very much appears to be not doing so at all!
I'll paste the code in below - the whole page in case for some reason something earlier in the code is stopping it from working...please be gentle with it as it's the first programme i've written for 15 years...:)
Thanks very much...
Paul
<% Option Explicit %>
<!-- #include virtual="common/adovbs.inc" -->
<%
Dim connect, records, query, level
set connect = Server.CreateObject("ADODB.Connection")
connect.open "list"
set records = Server.CreateObject("ADODB.Recordset")
query = "SELECT Username,Password,Access FROM list"
records.Open Query, Connect, adOpenDynamic
records.MoveFirst
Do until records.EOF
If records ("Username") = Request("Username") And records ("Password") = Request("Password") then
If records ("Access") = "Fellow" Then
response.Cookies("members")("level") = "Fellow"
response.Redirect("fellows.asp")
ElseIf records ("Access") = "Team" Then
Response.Cookies("members")("level") = "Team"
response.Redirect("Team.asp")
ElseIf records ("Access") = "PM" Then
response.Cookies("members")("level") = "PM"
response.Redirect("PM.asp")
ElseIf records ("Access") = "Assoc" Then
response.Cookies("members")("level") = "Assoc"
response.Redirect("Assoc.asp")
End If
End If
records.MoveNext
loop
Response.Redirect("error.asp")
%>
I'm pretty new to this programming lark (although I used to make my Amstrad CPC464 draw houses in basic ;)
With a little help from ASP for dummies, i've managed to write a login system - it checks against an access database for username and password, and then redirects the users to the page appropriate to their level of access within the organisation I work for (a national education charity in the UK)...So far, so extrememly exciting (for me at least :)
However, for some bizzare reason, the part of the code which, having accertained their level of access is then supposed to write a cookie, very much appears to be not doing so at all!
I'll paste the code in below - the whole page in case for some reason something earlier in the code is stopping it from working...please be gentle with it as it's the first programme i've written for 15 years...:)
Thanks very much...
Paul
<% Option Explicit %>
<!-- #include virtual="common/adovbs.inc" -->
<%
Dim connect, records, query, level
set connect = Server.CreateObject("ADODB.Connection")
connect.open "list"
set records = Server.CreateObject("ADODB.Recordset")
query = "SELECT Username,Password,Access FROM list"
records.Open Query, Connect, adOpenDynamic
records.MoveFirst
Do until records.EOF
If records ("Username") = Request("Username") And records ("Password") = Request("Password") then
If records ("Access") = "Fellow" Then
response.Cookies("members")("level") = "Fellow"
response.Redirect("fellows.asp")
ElseIf records ("Access") = "Team" Then
Response.Cookies("members")("level") = "Team"
response.Redirect("Team.asp")
ElseIf records ("Access") = "PM" Then
response.Cookies("members")("level") = "PM"
response.Redirect("PM.asp")
ElseIf records ("Access") = "Assoc" Then
response.Cookies("members")("level") = "Assoc"
response.Redirect("Assoc.asp")
End If
End If
records.MoveNext
loop
Response.Redirect("error.asp")
%>