Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   ASP (http://www.programmingforums.org/forum32.html)
-   -   Help (http://www.programmingforums.org/showthread.php?t=8472)

Heba Feb 19th, 2006 3:45 AM

Help
 
Hi ..

I am new here and i really need help .. In ASP

This is the form code

:

<form name="login" method="post" action="confirm.asp">
        <div align="center">         
          <p><br>
            <strong><span class="style16">Please insert your username and password to log into the system. </span></strong></p>
          <table width="312" border="1" cellspacing="3" bordercolor="#000000">
    <tr>
      <td width="92"><span class="style15">Username:</span></td>
      <td width="195" colspan="2"><input type=text name="username" size="25"></td>
      </tr>
    <tr>
      <td><span class="style15">Password:</span></td>
      <td colspan="2"><input type=text name="password" size="25"></td>
      </tr>
    <tr>
      <td colspan="3"><div align="center">
        <input name="Submit" type="submit" value="Submit">
      </div></td>
      </tr>
  </table>
  <br>
        </div>
      </form>


This is the confirm.asp


:

<%
DIM strUsername, strPassword
strUsername = Request.Form("username")
strPassword = Request.Form("password")


IF strUsername <> "" AND strPassword <> "" THEN

' Process the form as you like here
' For example enter form to your database or send it via email

ELSE

Response.Write "<p>Please click back on your browser and complete the following fields:</p>"
IF strUsername <> "" THEN
ELSE
Response.Write "<b>• Username</b><br>"
END IF
IF strPassword<> "" THEN
ELSE
Response.Write "<b>• Password</b><br>"
END IF

END IF
%>


But it doesnt work .. All i want is to check if the username and password match then they willl log in

Heba Feb 19th, 2006 5:33 AM

Can someone just tell what is wrong with the code please

asp1 Feb 19th, 2006 4:19 PM

I don't think there's anything wrong with your code
have you tested it?

Heba Feb 19th, 2006 10:24 PM

yes i did .. it takes me to the next page in all cases!

Heba Feb 20th, 2006 4:21 AM

Hi again .. ok lets say when the username and pass are correct
i want the user to directly go to the menu.asp page ... how can i do that?

Polyphemus_ Feb 20th, 2006 4:26 AM

Quote:

Originally Posted by Heba
:

IF strUsername <> "" AND strPassword <> "" THEN

' Process the form as you like here
' For example enter form to your database or send it via email

ELSE


But it doesnt work .. All i want is to check if the username and password match then they willl log in

Writing the code to log in would help a lot, I guess.


Quote:

Originally Posted by Heba
Hi again .. ok lets say when the username and pass are correct
i want the user to directly go to the menu.asp page ... how can i do that?

Google is your friend. I don't even know ASP, but it was quite easy to find:
:

response.AddHeader "location", "menu.asp"
I'm not sure this works though. Another thing is that you have to call this function before outputting anything. In fact, you don't have to output anything since you will never see it anyway.
If you want the user to see the message for let's say 5 seconds, use this code:
:

<meta http-equiv="refresh" content="5;url=menu.asp">

Heba Feb 20th, 2006 4:44 AM

:

<meta http-equiv="refresh" content="5;url=menu.asp">

Where do i have to put it will this do?

:

strUsername = Request.Form ("username")
strPassword = Request.Form ("password")

If strUsername="john" And strPassword="123" Then
    Response.Write("OK to go!")
  <meta http-equiv="refresh" content="5;url=menu.asp">
 End If



Thank you !

Polyphemus_ Feb 20th, 2006 5:08 AM

You have to put it in the header section of the HTML part.

Heba Feb 20th, 2006 5:34 AM

Aha thank you!

DaWei Feb 20th, 2006 7:02 AM

Welcome to the forums, but please read the rules/FAQ and a "How to Post..." thread. "HELP" is not an acceptable subject line.


All times are GMT -5. The time now is 4:56 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC