Logging In Using ASP - Access2000

Written by Amrit Hallan


Continued from page 1

A few things. In order to use a database through ASP, you need to have a DNS created for that database onrepparttar server.

STORELOG.ASP should somewhat look like this:

<% dim sEmail, sPass, noError noError="y" sEmail=request.form("email") sPass=request.form("pass")

' The following lines setup a connection torepparttar 107886 DNS we created above

Dim toDatabase 'To connect torepparttar 107887 DNS Dim toRecordset 'To connect torepparttar 107888 individual tables

Set toDatabase = Server.CreateObject("ADODB.Connection") toDatabase.Open "customers"

Set toRecordset = Server.CreateObject("ADODB.Recordset") toRecordset.Open "logins", toDatabase, 2

' 2 = Opensrepparttar 107889 recordset in "Write Mode"

' Let us say "logins" is some table you created inrepparttar 107890 database.

toRecordset.AddNew toRecordset("email")=sEmail toRecordset("password")=sPass on error resume next toRecordset.Update if err.number<>0 then ' do something if some error occurs. ' one error could be thatrepparttar 107891 email already exists inrepparttar 107892 database. noError="n" end if

toRecordset.Close

Set toRecordset = Nothing

toDatabase.Close

Set toDatabase = Nothing

if noError="y" then ' Ifrepparttar 107893 info was saved smoothly.

session("email")=sEmail session("pass")=sPass end if

' Here you can display some message thatrepparttar 107894 record has been saved. %>

This savesrepparttar 107895 login information of a new customer. Now, how do we use it inrepparttar 107896 future? First,repparttar 107897 login form, that could be on any page.

Remember you can use somewhat same validation Javascript here too, so I'm not repeating it, but just mentioning it.

Please login by entering your email and password.

Enter Email:

Enter Password:

LOGIN.ASP

Atrepparttar 107898 top ofrepparttar 107899 page, along with other ASP commands, include this too:

<% response.buffer=true %>

This is required if you want to sendrepparttar 107900 user to some page after he/she has successfully logged in.

<%

dim sEmail, sPass, noError noError="y" sEmail=request.form("email") sPass=request.form("pass")

' The following lines setup a connection torepparttar 107901 DNS we created above

Dim toDatabase 'To connect torepparttar 107902 DNS Dim toRecordset 'To connect torepparttar 107903 individual tables

Set toDatabase = Server.CreateObject("ADODB.Connection") toDatabase.Open "customers"

fndSQL="select * from logins where email='" & sEmail & "' and password='" & sPass & "'"

Set toRecordset=toDatabase.execute(fndSQL)

if toRecordset.eof then

response.write "Your details are not inrepparttar 107904 database, please try again, or register yourself."

else

session("email")=toRecordset("email") session("pass")=toRecordset("password")

end if

toRecordset.Close

Set toRecordset = Nothing

toDatabase.Close

Set toDatabase = Nothing

response.redirect "To some URL"

%>

>From now onwards, whenever you want to perform some action that should only be performed ifrepparttar 107905 user is logged in, just checkrepparttar 107906 value is session("email"), like:

<%

if session("email")<>"notlogged" then

' do things forrepparttar 107907 logged in customer

else

' tellrepparttar 107908 customer that he she is not logged in.

end if

%>

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


DHCP

Written by Richard Lowe


Continued from page 1

To use DHCP is so straightforward thatrepparttar only excuse for not using it is lack of knowledge. You create a DHCP server - depending uponrepparttar 107885 size of your network this can be added to an existing server (the network traffic is not usually very high) or you may need to use a dedicated system. Some people userepparttar 107886 DHCP server that comes with Windows NT or whatever operating system they happen to be running. We foundrepparttar 107887 best solution was to purchase a "DHCP appliance" - a small computer intended to host DHCP and only DHCP.

Once you've got your DHCP server installed, you use an interface of some kind (often just any browser such as Internet Explorer) to define your network parameters. These includerepparttar 107888 range of available TCP/IP addresses,repparttar 107889 gateway address,repparttar 107890 addresses (primary and secondary) of your DNS or name servers, and any of dozens of other parameters.

Now comesrepparttar 107891 really cool part. From this point forward, any machine on your network can, if told to do so, get all ofrepparttar 107892 TCP/IP information from this DHCP server. This means you no longer need to enter and/or change any of this data. It's all handled for you. Windows 2000 Professional systems even use DHCP by default, which means new workstations practically work out ofrepparttar 107893 box.

To make this all easy for home users as well, many hardware firewalls include a DHCP server as part ofrepparttar 107894 package. This means if you get one of these firewalls (and it will tell you onrepparttar 107895 box or instructions if it has a DHCP server built-in) you can just plug computers in at home and not worry very much about TCP/IP.

The bottom line is there is no reason not to use DHCP for your workstations, laptops and handheld devices (it's not a good idea in general to use it for servers). You can even use it at home if you getrepparttar 107896 proper firewall.



Richard Lowe Jr. is the webmaster of Internet Tips And Secrets at http://www.internet-tips.net - Visit our website any time to read over 1,000 complete FREE articles about how to improve your internet profits, enjoyment and knowledge.


    <Back to Page 1
 
ImproveHomeLife.com © 2005
Terms of Use