Logging In Using ASP - Access2000

Written by Amrit Hallan


After receiving a few queries about how to store passwords using ACCESS and ASP, and then use them as "logins", I thought, well, why not write in a separate article, instead of attaching multiple ASP files that are full of confusing comments and variables only to be decipherable by my brain?

I'm assuming you've installed, and are running PWS (Personal Web Server) on your machine, if you are not already working on a server that supports ASP.

First of all, create a database, for instance, customers.Define a table with allrepparttar fields you require (include email and password).

Afterrepparttar 107886 database has been created, you need to create a DNS in order to access this database through your ASP pages.

If you have never created it, this is how you do it:

Go torepparttar 107887 Control Panel (My Computer -> Control Panel), and click onrepparttar 107888 icon that should be saying "ODBC Data Sources (32bit)". Inrepparttar 107889 resulting window, selectrepparttar 107890 "System DSN" tab. Then click onrepparttar 107891 "Add..." button. Fromrepparttar 107892 given list of Database drivers, select "Microsoft Access Driver (*.mdb)" and clickrepparttar 107893 "Finish" button. You reach a place where you have to enterrepparttar 107894 "Data Source Name". Enter it, anything, for instance, "customers". Then clickrepparttar 107895 "Select..." button. This lets you selectrepparttar 107896 Access database you created. Press Ok, press Ok, and press Ok. Your DSN is created.

Inrepparttar 107897 first part, I'll write about storingrepparttar 107898 passwords.

Before this, let's make an include file to create and initializerepparttar 107899 session variables that we are going to need (we can use cookies, but some clever folks disable cookies on their browsers).

File name: sessions.inc

<%

if session("email")="" then session("email")="notlogged" session("pass")="" end if

%>

This file you can include in every page as

so that you can use them whenever you need them.

Now accepting login and password.

For this you require a normal HTML form. You can have "n" number of fields in a form, but here, our primary concern is, gettingrepparttar 107900 email as login, andrepparttar 107901 accompanying password.

Here'srepparttar 107902 form:

Please enter your details:

Enter Email:

Enter Password:

We validaterepparttar 107903 form before it proceeds torepparttar 107904 "action" file so that there is very little server-side processing. A simple validation:

Note: Putrepparttar 107905 following Javascript aboverepparttar 107906 tag.

So now whenrepparttar 107910 user clicks on "Submit", he/she goes to "storelog.asp" In between, you can have a file to confirmrepparttar 107911 form fields and giverepparttar 107912 user an option to modify them before finally saving.

DHCP

Written by Richard Lowe


At my day job, we were tasked with creating a Windows NT 4.0 network from scratch with only minimal training onrepparttar operating system. We were experts at working with OpenVMS and MacIntosh systems, but none of us had ever seen Windows NT before. In those days long ago we were very cocky, and very naive - how hard could it be to set up a new TCP/IP network? After all, we had mastered DECnet and Appletalk, could IP be any harder?

We soon learnedrepparttar 107885 error of our ways - TCP/IP is far more complex than we had originally believed. However, after some head scratching and a few phone calls, we managed to get our network up and running.

We didn't know any better, so we simply hard codedrepparttar 107886 TCP/IP address into each workstation and server. In fact, we hard coded everything, includingrepparttar 107887 DNS and WINS server addresses,repparttar 107888 subnet andrepparttar 107889 gateway address.

For our purposes, this worked great for several years. We added machines slowly and planned everything far in advance, so it was no big deal to just add a new machine torepparttar 107890 network. A few simple edits torepparttar 107891 network control panel was all that was needed, and since our network was very static, we didn't have to visit those setting very often at all.

As our company grew this scheme started to get more and more awkward. Originally we had a nice, isolated, self-contained network, but now we needed to get onrepparttar 107892 internet, we were adding not only new workstations and servers at a furious rate, but we had to deal with PDAs, handheld systems, standalone file servers and hundreds of other computers.

To make matters even worse, where our network was very static, now it was becoming dynamic. Computers would be added and removed constantly - someone would plug his handheld into an ethernet jack, get their email, unplug and be gone.

The static TCP/IP scheme that we had been using (a spreadsheet with a list of machines and related addresses) was simply no longer working. Fortunately, there was an answer - DHCP.

The acronym DHCP stands for "Dynamic Host Configuration Protocol", and it means exactly what it says. Once we discovered this new tool we realized we had foundrepparttar 107893 solution to our problem - and we kicked ourselves mentally for not reading up on this wonderful tool long before.

Cont'd on page 2 ==>
 
ImproveHomeLife.com © 2005
Terms of Use