Hi Guys,

I am developing a Web based database for a company for my year work placement for university. As I am still a student I am still learning and finding this difficult.

I am looking at designing a login page using ASP, the code I have is:-

<%= sErrorMessage %></font>
<form action="login.asp" method="post" name="formlogin" id="formlogin">
<table width="528" height="136" border="1">
<tr>
<td width="153">username</td>
<td width="359"><input name="txtusername" type="text" id="txtusername" size="50"></td>
</tr>
<tr>
<td>password</td>
<td><input name="txtpassword" type="password" id="txtpassword" size="20"></td>
</tr>
<tr>
<td>click button to login </td>
<td><input name="btnlogin" type="submit" id="btnlogin" value="login"></td>
</tr>
</table>
</form>

I realise that this code is for inputting the username and password but, how would I go about enabling the page to recognise the username and password as correct then to login and how would I do this with a number of different user names?

And suggestions would be appreciated.
Thanks!

Recommended Answers

All 5 Replies

Member Avatar for fatihpiristine

post the datas to login.asp again
use get method to catch the posted infos. then
then connect ur database and
use while methoe with eof... if the entered values are the same end while circle and redirect the page where you want. you can find these login page everywhere.

Just allowing users after confirming from database is not enough. The other thing that you must keep in mind is that you have to track the users with the help of Session ID.
If you need more info on that, do let us know.

The logic is so simple .This can be implemented at the database level it self by using SQL statments. When the user tries to login check for existance of such an user with the corresponding password . If the user exists then go further.

To check for existance try to follow the sample SQL

SELECT COUNT(*) FROM USER_TABLE_NAME WHERE USERNAME='DEBASIS' AND PASSWORD='DEBASIS'

If the sample query returns 1 then login else display a message like invalid username or password.

Just allowing users after confirming from database is not enough. The other thing that you must keep in mind is that you have to track the users with the help of Session ID.
If you need more info on that, do let us know.

yeah, I know what a Session ID is but how would I need this or go about using it?

sorry if I am asking really simple questions but... best way i can learn.

yeah, I know what a Session ID is but how would I need this or go about using it?

sorry if I am asking really simple questions but... best way i can learn.

no need to sorry. this is how i learn things.
well, you know that every time explorer access a server, a session ID is generated. This session ID is used to track the authenticity of the users as he moves to other pages of the site. If this is not done, then one can access the page just by copying and pasting the URL of web pages other than the main page where login is required (try this out for your application).
now the question is how to do it?
there are a numbers of ways of doing it. one can store the Session ID is a hidden field and pass it to the web pages as the users moves.
you can find implementation details through "Google" as I done this a very long time ago.
if need help, do let us know.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.