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: 3 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: 3 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 Apr 14th, 2006, 12:52 PM   #9
theGuru
Newbie
 
Join Date: Apr 2006
Posts: 2
Rep Power: 0 theGuru is on a distinguished road
Quote:
Originally Posted by Heba
<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 !
Hello,
I think you can use
If strUsername="john" And strPassword="123" Then
    Response.Redirect("menu.asp")
 End If
Its the best way to redirect the user to another page.
theGuru is offline   Reply With Quote
Old Apr 14th, 2006, 1:46 PM   #10
java_roshan
Professional Programmer
 
Join Date: Mar 2005
Location: Student of University of Mumbai, Maharashtra State, India
Posts: 344
Rep Power: 4 java_roshan is on a distinguished road
Quote:
Originally Posted by theGuru
Hello,
I think you can use
Response.Redirect("menu.asp")
Its the best way to redirect the user to another page.
Or an alternative to this, recommended by Microsoft is
Server.Execute("menu.asp")
__________________
Visit: http://www.somaiya.edu
java_roshan 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 10:32 PM.

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