Logging,Using,ASP,Access2000,A computer Logging In Using ASP - Access2000


Gone are those times when the companies and the organisations didn't need a hi-tech system to handle them. Owing to the considerable increase in the business sector and thus, an enormous increase in the complexity of the organisational struc ----------------------------------------------------------Permission is granted for the below article to forward,reprint, distribute, use for ezine, newsletter, website,offer as free bonus or part of a product for sale as longas no changes a


After receiving a few queries about how to store passwords usingACCESS and ASP, and then use them as "logins", I thought, well,why not write in a separate article, instead of attachingmultiple ASP files that are full of confusing comments andvariables only to be decipherable by my brain?I'm assuming you've installed, and are running PWS (Personal WebServer) on your machine, if you are not already working on aserver that supports ASP.First of all, create a database, for instance, customers.Define atable with all the fields you require (include email andpassword).After the database has been created, you need to create a DNS inorder 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 clickon the icon that should be saying "ODBC Data Sources (32bit)". Inthe resulting window, select the "System DSN" tab. Then click onthe "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 "DataSource Name". Enter it, anything, for instance, "customers". Thenclick the "Select..." button. This lets you select the Accessdatabase you created. Press Ok, press Ok, and press Ok. Your DSNis created.In the first part, I'll write about storing the passwords.Before this, let's make an include file to create and initializethe session variables that we are going to need (we can usecookies, but some clever folks disable cookies on theirbrowsers).File name: sessions.inc<%if session("email")="" then session("email")="notlogged" session("pass")=""end if%>This file you can include in every page asError processing SSI file
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" numberof fields in a form, but here, our primary concern is, gettingthe email as login, and the accompanying password.Here's the form:Please enter your details:We validate the form before it proceeds to the "action" file sothat there is very little server-side processing. A simplevalidation:Note: Put the following Javascript above the tag.So now when the user clicks on "Submit", he/she goes to"storelog.asp" In between, you can have a file to confirm theform fields and give the user an option to modify them beforefinally saving.A few things. In order to use a database through ASP, you need tohave a DNS created for that database on the server.STORELOG.ASP should somewhat look like this:<%dim sEmail, sPass, noErrornoError="y"sEmail=request.form("email")sPass=request.form("pass")' The following lines setup a connection to the DNS we createdaboveDim toDatabase 'To connect to the DNSDim toRecordset 'To connect to the individual tablesSet toDatabase = Server.CreateObject("ADODB.Connection")toDatabase.Open "customers"Set toRecordset = Server.CreateObject("ADODB.Recordset")toRecordset.Open "logins", toDatabase, 2' 2 = Opens the recordset in "Write Mode"' Let us say "logins" is some table you created in the database.toRecordset.AddNewtoRecordset("email")=sEmailtoRecordset("password")=sPasson error resume nexttoRecordset.Updateif err.number<>0 then' do something if some error occurs.' one error could be that the email already exists in thedatabase. noError="n"end iftoRecordset.CloseSet toRecordset = NothingtoDatabase.CloseSet toDatabase = Nothingif noError="y" then' If the info was saved smoothly. session("email")=sEmail session("pass")=sPassend if' Here you can display some message that the record has beensaved.%>This saves the login information of a new customer. Now, how dowe use it in the future? First, the login form, that could be onany page.Remember you can use somewhat same validation Javascript heretoo, so I'm not repeating it, but just mentioning it.Please login by entering your email and password.LOGIN.ASPAt the top of the page, along with other ASP commands, includethis too:<% response.buffer=true %>This is required if you want to send the user to some page afterhe/she has successfully logged in.<%dim sEmail, sPass, noErrornoError="y"sEmail=request.form("email")sPass=request.form("pass")' The following lines setup a connection to the DNS we createdaboveDim toDatabase 'To connect to the DNSDim toRecordset 'To connect to the individual tablesSet toDatabase = Server.CreateObject("ADODB.Connection")toDatabase.Open "customers"fndSQL="select * from logins where email='" & sEmail & "' andpassword='" & sPass & "'"Set toRecordset=toDatabase.execute(fndSQL)if toRecordset.eof then response.write "Your details are not in the database, pleasetry again, or register yourself."else session("email")=toRecordset("email") session("pass")=toRecordset("password")end iftoRecordset.CloseSet toRecordset = NothingtoDatabase.CloseSet toDatabase = Nothingresponse.redirect "To some URL"%>>From now onwards, whenever you want to perform some action thatshould only be performed if the user is logged in, just check thevalue is session("email"), like:<%if session("email")<>"notlogged" then' do things for the logged in customerelse' tell the customer that he she is not logged in.end if%>Hope this helps. If you need further queries, or in future youneed some other ASP work, you are welcome to write to me [email protected].

Logging,Using,ASP,Access2000,A

computer

Equipment Rental Software – Features And Cost

Equipment rental management software is an essential thing these days for any equipment rental company.A well-developed equipment rental software provides you with a variety of features that can really help you maintain and organise your cus ...

computer

5 Big Reasons Why I Migrated From Angularjs To React

I have 5 main reasons for my angularjs to react migration. No, it's not a comparison on which is better. A comparison between apples and oranges would make no point. React is a library, and angular is a framework. Both can do stuff in their ...

computer

How to troubleshoot McAfee error 2318?

Security software means McAfee! For many computer users, McAfee antivirus is the only choice for security software as it provides all the features and tools which are necessary for device and data protection. This robust antivirus merely sho ...

computer

Manage Multiple Counter With AlignBooks Point of Sale

Fulfilling your businesss needs which can grow your firm is our aim. AlignBooks is better known for providing a strong pillar to newly started or midway businesss. Those companies who dont want to fall back with irregularity manage the inven ...

computer

How to Autoplay Embedded YouTube Videos

Source: How to Autoplay Embedded YouTube VideosEmbedding a video or audio enables the users to share their videos with any of their preferred sites or any social networking platforms. They can do so by copying the embedded link of the parti ...

computer

3 Major Mistakes to Avoid in Retail Business

Truth be told, nearly half of the retail businesses survive longer than four years and which can be something to ponder for a newbie before stepping into the industry. However, this being said, it is also true that you can excel in the indus ...

computer

Start Your Own Computer Repair Business

1. Know your street value. In the early 90's, running a PC repair business centered around selling parts and products, with service on the side. Today, it's about selling hours. If you run a business, you need to consider the X3 rule. That m ...

computer

How Establishments Show Up in Restaurant Searches

The revolutionary rise of technology has made things easy-peasy for consumers in the restaurant industry. Unlike the old days, the availability of innumerable platforms has made it possible for diners to choose from various searching options ...

computer

GuildWars 2 :

The last expansion pack for Guild Wars 2 was Path of Fire, which was released in 2017 and brings you a new enemy-Balthazar, the evil god of war. Although this doesn't sound like another expansion pack currently in production, some fans ma ...

computer

Customer Support at the time of COVID-19 Pandemic

COVID-19 is the worst crisis of our time as we observe social distancing protocols being imposed all around the world. While these measures are a step in effectively managing the COVID-19 pandemic, Hospitality and Retail businesses are confr ...

computer

How to Choose a Contract Management Solution (CLM)?

Contract life cycle management (CLM) systems can simplify and automate contract creation, negotiation, execution and storage. They are an intelligent alternative to the tedious hand tools formerly used for these tasks, which lacked visibili ...

computer

Contacting Google Live Person to Resolve Your Issues

Users are fond of all the Google supported products and look forward to the best services. Also, Google as a whole has never disappointed its users and helped them at every point with its commendable services. Also, being a customer-oriente ...

computer

how to uninstall discord

How to Uninstall Discord in Windows 10? has supported open source technologies, our tool is secure and safe to use. To uninstall a discord from your windows, you'll use this method which is given below.USING THIRD PARTY TOOLS1. Firstly, you ...