วันอังคารที่ 30 มิถุนายน พ.ศ. 2552

Logging In Using ASP - Access2000

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 all the fields you require (include email and password).

After the 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 to the Control Panel (My Computer -> Control Panel), and click on the icon that should be saying "ODBC Data Sources (32bit)". In the resulting window, select the "System DSN" tab. Then click on the "Add..." button. From the given list of Database drivers, select "Microsoft Access Driver (*.mdb)" and click the "Finish" button. You reach a place where you have to enter the "Data Source Name". Enter it, anything, for instance, "customers". Then click the "Select..." button. This lets you select the Access database you created. Press Ok, press Ok, and press Ok. Your DSN is created.

In the first part, I'll write about storing the passwords.

Before this, let's make an include file to create and initialize the 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

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, getting the email as login, and the accompanying password.

Here's the form:

Please enter your details:

Enter Email:

Enter Password:

We validate the form before it proceeds to the "action" file so that there is very little server-side processing. A simple validation:

Note: Put the following Javascript above the tag.

function validate()
{
var res=true;
allok=true;
// Checking that the email has been entered. if(document.login_info.email.value=="" || document.login_info.email.value==null) {
alert("Sorry, you cannot register without an email address.");
res=false;
allok=false;
document.login_info.email.focus(); }
// Checking that the password is right. if(allok==true)
// I'm using allok here because if allok is false, no use checking for the next field. {

if(document.login_info.pass.value.lengthFrom now onwards, whenever you want to perform some action that
should only be performed if the user is logged in, just check the value is session("email"), like:

Hope this helps. If you need further queries, or in future you need some other ASP work, you are welcome to write to me at amrit@bytesworth.com.

Amrit Hallan is a freelance web designer. For all web site development and web promotion needs, you can get in touch with him at http://www.bytesworth.com. For more such articles, visit http://www.bytesworth.com/articles and http://www.bytesworth.com/learn You can subscribe to his newsletter [BYTESWORTH REACHOUT] on Web Designing Tips & Tricks by sending a blank email at bytesworth-subscribe@topica.com



by Amrit Hallan

Asp R Bed Linen



Welcome to Alfresco Emporium - Bed & Bath - Linens - Bed Linens

The Maine collection from Devilla is an exclusive creation designed to turn your house into a dream home. A completely coordinated collection of bed and bath linens, it

Welcome to Alfresco Emporium - Bed & Bath - Linens - Bed Linens

With the finest percale cotton, the Lexington range allows you to combine colours and styles, whether you live in the city or in the countryside. White is the primary

Super Soft Organic Cotton Bed Linen --- Natural Mat

For the ultimate natural sleeping experience, cover your Naturalmat mattress with our beautifully soft organic cotton flat and

The 2009 World Market Forecasts for Imported Textile Bed Linens

The 2009 World Market Forecasts for Imported Textile Bed Linens Excluding Cotton Bed Linens This report was created for strategic planners, international marketing executives and

White bed sheets from Sferra bedding, Sferra bed linens

sateen bed linens, Italian bedding, designer bed linens Home: Bed Linens: S F E R R A: SFERRA Classico 100% Linen sheets 100% pure white linen sheets from SFERRA are

Emerson in champagne bed linens by SFERRA

bed linens, Italian bedding, designer bed linens Home: Bed Linens: S F E R R A: Emerson in champagne bed linens by SFERRA Emerson New By SFERRA; Stately pleasures.

Hospital Bed Linens And Sheets

Bariatric Bed-In-A-Bag by Invacare(R) Supply Group - Cotton polyester blend linen fits bariatric size hospital bed mattress up to 42" x 80" x 8".

SBMC 2008

Breakfast, bed linens and towels is included in the price. 2 beds (single with pullman bed): SEK 3 800 3 beds (double with pullman bed): SEK 5 550..

Panel Report On Ec Bed Linen

This site uses cookies to ensure security but it seems that you disabled them.

IKEA | Textiles | Bed textiles | Bed linen

All items featured are available on a while stocks last basis. IKEA reserves the right to amend/ adjust any price due to misprint or price changes as a result of circumstances

Beds UK Forum

T O P I C R E V I E W: frenchdressing: Posted - 30 The 'thread' count of bed linen is often used as an indicator of http://www.french-dressing.com/new_catog-build2.asp?cd=10

Bed Linens Resources for Hotel & Lodging

Bed Linens Resources for Hotel & Lodging, Bed Linens Hotel & Lodging Add URL

Yves Delorme Gramine Bedding - Heirloom Iron Bed and Fine Linens

Yves Delorme Luxury French Linens and Bedding for the Home. We offer a full selection of Yves Delorme fine French linens, including luxury bedding, flat sheets, fitted sheets

Linensource ? Bed linens, luxury bed sheets, bedspreads, quilts and

linensource offers a rich selection of bedroom and bath furnishings from today's top designers to renew, brighten and refresh your home.

SVOBODA LINEN, s.r.o.

SVOBODA LINEN, s.r.o. Svatoplukova 1048 698 01 Vesel nad Moravou tel: +420-518 326 670 Bed linen of cotton (excl. knitted or crocheted) Bed linen of woven textiles (excl. of

1 ความคิดเห็น: