Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 19th, 2006, 3:45 AM   #1
Heba
Newbie
 
Join Date: Feb 2006
Posts: 18
Rep Power: 0 Heba is on a distinguished road
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 is offline   Reply With Quote
Old Feb 19th, 2006, 5:33 AM   #2
Heba
Newbie
 
Join Date: Feb 2006
Posts: 18
Rep Power: 0 Heba is on a distinguished road
Can someone just tell what is wrong with the code please
Heba is offline   Reply With Quote
Old Feb 19th, 2006, 4:19 PM   #3
asp1
Newbie
 
Join Date: Feb 2006
Posts: 7
Rep Power: 0 asp1 is on a distinguished road
I don't think there's anything wrong with your code
have you tested it?
asp1 is offline   Reply With Quote
Old Feb 19th, 2006, 10:24 PM   #4
Heba
Newbie
 
Join Date: Feb 2006
Posts: 18
Rep Power: 0 Heba is on a distinguished road
yes i did .. it takes me to the next page in all cases!
Heba is offline   Reply With Quote
Old Feb 20th, 2006, 4:21 AM   #5
Heba
Newbie
 
Join Date: Feb 2006
Posts: 18
Rep Power: 0 Heba is on a distinguished road
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?
Heba is offline   Reply With Quote
Old Feb 20th, 2006, 4:26 AM   #6
Polyphemus_
Expert Programmer
 
Polyphemus_'s Avatar
 
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4 Polyphemus_ is on a distinguished road
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">
Polyphemus_ is offline   Reply With Quote
Old Feb 20th, 2006, 4:44 AM   #7
Heba
Newbie
 
Join Date: Feb 2006
Posts: 18
Rep Power: 0 Heba is on a distinguished road
<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 !
Heba is offline   Reply With Quote
Old Feb 20th, 2006, 5:08 AM   #8
Polyphemus_
Expert Programmer
 
Polyphemus_'s Avatar
 
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4 Polyphemus_ is on a distinguished road
You have to put it in the header section of the HTML part.
Polyphemus_ is offline   Reply With Quote
Old Feb 20th, 2006, 5:34 AM   #9
Heba
Newbie
 
Join Date: Feb 2006
Posts: 18
Rep Power: 0 Heba is on a distinguished road
Aha thank you!
Heba is offline   Reply With Quote
Old Feb 20th, 2006, 7:02 AM   #10
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Welcome to the forums, but please read the rules/FAQ and a "How to Post..." thread. "HELP" is not an acceptable subject line.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:52 PM.

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