SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Mar 2005
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Whats wrong with this?

    whats wrong with this .... doesnt seem to redirect to update.asp when its a valid login/password ...

    Code:
    <%
    set myConn = server.createobject("ADODB.connection")
    myConn.open "Orderinfo", "IWSDstudent", "assign2"
     
    dim strUsername, strPassword, strSQL
    strUsername = Request.Form("username") 
    strPassword = Request.Form("password") 
    strSQL = "SELECT * FROM contact "
    strSQL = strSQL & "WHERE contactID = '" & strUsername & "' "
    strSQL = strSQL & "AND contactPassword = '" & strPassword & "'"
     
    set rs = myConn.Execute(strSQL)
    If rs.EOF Then 
    response.redirect "login.asp?message=" & Server.URLEncode("Invalid login name and/or password")
    Else 
    Session("username") = rs("username")
    Session.Timeout=30
    Response.redirect "details.asp"
    End if 
     
    rs.close
    myConn.close
    %>

  2. #2
    SitePoint Member
    Join Date
    Mar 2005
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry ... i meant

    doesnt seem to redirect to details.asp when its a valid login/password ...

    dont know where update.asp came from ...

  3. #3
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <%
    
    Set myConn = server.createObject("ADODB.Connection")
    myConn.open "Orderinfo","IWSDstudent","assign2"
    
    Set Login = server.createobject("ADODB.Recordset")
    Login.open "SELECT * FROM contact WHERE contactID = '" & Request.form("username") "' AND contactPassword = '" & Request.Form("password") & "'", myConn, 2, 2
    
    if login.eof then
    
    login.close
    connection.close
    
    response.redirect("login.asp?message=" & Server.URLEncode("Invalid login name and/or password")
    
    else
    
    Session("username") = rs("username")
    Session.Timeout=30
    Response.redirect "details.asp"
    
    end if
    
    %>
    Give that a try,

  4. #4
    SitePoint Member
    Join Date
    Mar 2005
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    Error: Access is Denied. 
    Microsoft VBScript compilation error '800a0401' 
    
    Expected end of statement 
    
    /iwsd/iwsd019/assignment2/verify.asp, line 18 
    
    Login.open "SELECT * FROM contact WHERE contactID = '" & Request.form("username") "' AND contactPassword = '" & Request.Form("password") & "'", myConn, 2, 2
    ----------------------------------------------------------------------------------^

  5. #5
    SitePoint Member
    Join Date
    Mar 2005
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I got rid of the issue above, yet still problem ...

    Code:
    <%
    
    Set myConn = server.createObject("ADODB.Connection")
    myConn.open "Orderinfo","IWSDstudent","assign2"
    
    Set Login = server.createobject("ADODB.Recordset")
    dim strSQL
    strSQL = "SELECT * FROM contact "
    strSQL = strSQL & "WHERE contactID = '" & Request.form("username") & "' "
    strSQL = strSQL & "AND contactPassword = '" & Request.Form("password") & "'"
    
    Login.open strSQL, myConn, 2, 2
    
    if Login.eof then
    
    Login.close
    myConn.close
    
    response.redirect("login.asp?message=" & Server.URLEncode("Invalid login name and/or password"))
    
    else
    
    Session("username") = rs("username")
    Session.Timeout=30
    Response.redirect "details.asp"
    
    end if
    
    %>
    Shouldnt have anything to do with the login.asp?

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
    	<title>Login</title>
    	<link rel="stylesheet" type="text/css" href="Assign2.css">
    <body>
    <%
    response.write cstr(request("message")) 
    session.Abandon
    set rs = nothing
    %>
    <p>&nbsp;</p>
    <p><img src="alumi.jpg" width="450" height="250" /></p>
    <p><img src="login.jpg" width="300" height="150" /></p>
    <form name="form1" id="form1" method="post" action="verify.asp">
      <p><img src="userpass.jpg" width="300" height="100" /></p>
      <p>
        <input name="username" type="text" maxlength="10" />
    &nbsp;&nbsp;&nbsp;&nbsp;<input name="password" type="password" maxlength="12" />
    </p>
      <p>&nbsp;  </p>
      <p>
        <input type="button" name="Login" value="Login" />&nbsp;
        <input type="reset" name="Reset" value="Reset" />
    </p>
      <p>&nbsp;</p>
    </form>
    <p><img src="by.jpg" width="300" height="100" /></p>
    </body>
    </html>

  6. #6
    SitePoint Member
    Join Date
    Mar 2005
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How do i get out of this without looking like a complete fool ...

    <input type="button" name="Login" value="Login" />

    button should be submit

  7. #7
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <input type="submit" name="submit" value="submit" />

    Code:
    <%
    
    Set myConn = server.createObject("ADODB.Connection")
    myConn.open "Orderinfo","IWSDstudent","assign2"
    
    Set Login = server.createobject("ADODB.Recordset")
    Login.open "SELECT * FROM contact WHERE contactID = '" & Request.form("username") & "' AND contactPassword = '" & Request.Form("password") & "'", myConn, 2, 2
    
    if login.eof then
    
    login.close
    connection.close
    
    response.redirect("login.asp?message=" & Server.URLEncode("Invalid login name and/or password")
    
    else
    
    Session("username") = rs("username")
    Session.Timeout=30
    Response.redirect "details.asp"
    
    end if
    
    %>
    I missed out a &

    Gav


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •