• 0
Sign in to follow this  
Guest - Jean -

Link

Question

Guest - Jean -

Como posso inserir no código abaixo um link para outra página quando login for correto: EX: digito login e senha se correto exibir link para outra página se errado deixar como está (exibindo mensagem de erro).

Agradeço a quem me ajudar.

<%

Dim strSQL ' Structured Query Language

Dim objConn ' Database Connection

Dim objRs ' Recordset

Dim strLoginName ' Name user logs on with

Dim strLoginPassword ' Password to login with

Dim lngMemberID ' MemberID assigned to user account

' Grab Form Data

strLoginName = Request.Form("LoginName")

strLoginPassword = Request.Form("LoginPassword")

' Open Database

Set objConn = Server.CreateObject("ADODB.Connection")

Set objRs = Server.CreateObject("ADODB.Recordset")

objConn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("Members.mdb")

' Look for User

strSQL = "SELECT MemberID FROM Members WHERE LoginName = '" & strLoginName & "' AND LoginPassword = '" & strLoginPassword & "'"

Set objRs = objConn.Execute(strSQL)

' Notify visitor if account was found.

If objRs.EOF Then

Response.Write("Usuario ou senha desconhecido !")

Else

lngMemberID = objRs(0)

Response.Write("Login Succeeded, MemberID = " & lngMemberID)

End If

' Garbage Collection

Set objRs = Nothing

objConn.Close

Set objConn = Nothing

%>

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

If objRs.EOF Then

Response.Write("Usuario ou senha desconhecido !")

Else

lngMemberID = objRs(0)

Response.Write("Login Succeeded, MemberID = " & lngMemberID)

Response.Write("<a href='pagina.asp'>Link</a>")

End If

abraços

Share this post


Link to post
Share on other sites
  • 0
Guest - Jean -

Muito obrigado pela ajuda, já fiz e testei, funcionou.

Valeu mesmo.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this