|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
hI ...
I am newbie to ASP ... i am trying to write a code to accept login and passwor from a user and verify through a table created in MySQL. I am just trying to write a code on my own seeking help from code here and there and from my understanding. I am completely zapped :-((( here is my code:- DIM SQL DIM RSA DIM QUERY1 ConnString = "Driver={MySQL ODBC 3.51 Driver};" ConnString = ConnString & "Port=3306; " ConnString = ConnString & "DATABASE=test; " Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open ConnString <FORM ACTION="login.asp" METHOD="post"> <TABLE BORDER=0> <TR> <TD ALIGN="right">LOGIN:</TD> <TD><INPUT TYPE="text" NAME="txtID"></INPUT></TD> </TR> <TR> <TD ALIGN="right">PASSWORD:</TD> <TD><INPUT TYPE="password" NAME="txtPASSWORD"></INPUT></TD> </TR> <TR> <TD ALIGN="right"></TD> <TD><INPUT TYPE="submit" VALUE="Login"></INPUT> <INPUT TYPE="reset" VALUE="Reset"></INPUT> </TD> </TR> </TABLE> </FORM> QUERY1 = "SELECT stUDENT_ID,STUDENT_PASSWORD from STUDENT_INFO" SET RSA = = Server.CreateObject("ADODB.Recordset") Set RSA = conn.Execute(QUERY1,,adCmdText) if RSA.EOF then response.Write("NO MATCH") else if ([QUERY1.STUDENT_ID] = [txtID]) AND ([QUERY1.STUDENT_PASSWORD] = [txtPASSWORD]) then response.write "<p>" & "<center>" & "U CAN " & "</center>" & "</p>" else response.write "No ID FOUND" end if Set rs = Nothing Set conn = Nothing %> I know my code is not at all written nicely! Can anyone help me with a sample code for user-id verification? I want to know how to write a code using ASP (MYSQL). I dont even know where to put the % sign and whether html comes before select query...i am all so frustrated and confused ! any sample code help would vbe highly appreciated! thanks!!! ![]() |
|
#2
|
|||
|
|||
|
generally the first login page is html, the textbox and password entry and all that jazz, you submit to login.asp on your page, if it's a different page, then fine, if it's the same page as your own, then at the top of your page you'll need to query the DB for all the info. You at least have an idea for what you need to do what is good.
you're confused on <% %> tags it looks like. These cause whatever is inbetween these tags to be run at the server when it spits back html to the user. So at the top of the page you have to <% dim conn,strSQL,RS set conn ... conn.open ("connection string") then query and return the record set where user name and password = request.form("password") and login = request.form("password"). if RSA.eof then display a incorrect login div tag here else response.redirect ("index.html") end if %> Before doing anyqueries from asp, always open up mysql first and just hard code values in first. So open up mysql and check to make sure that your query string works, because it will differ on how you set up the password column.... tutorial |
|
#3
|
|||
|
|||
|
hey thanks..u r rite..
i was confused where to put what... i will now work out.. thanks tremendously! |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Login Password |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|