Installation
Copy the contents of this zip into the root or subfolder of your subfolder website.In the
"dataconn_inc.asp" you you need to set the ConnectionString
variable to match your data connection. Use a text editor to open and save that
page.
There are comments in that file that show examples of various data connections.
You also need to set the "DatabaseType" variable to either "SQL
or "MSACCESS"' depending on what database system you are using.
There is an example of using a System DSN or A DSN-LESS connection. By default it is set to use a DSN-LESS connection and by default the System DSN
code is commented out. A comment is ASP is a single quote. You put it at the
beginning of a line you want to comment out and have ignored by the compiler.
Read up on what the various connections types mean.
System
DSN or DSN-less Connection?
OLEDB
For Me
ACCESS
DATABASES (
DSN vs DSN-LESS )
The supplied Access database's have a password set on them by default.
It is "temp". The ASP
code has to specify that information in order to access the database, just like
you have to if you open the database with Microsoft Access. This is shown in the
connection string example below.
SYSTEM DSN Connection
If using a SYSTEM DSN connection a SYSTEM DSN must be set up on the server. This
has to be done by the server admins.
Here is an example of accessing a SYSTEM DSN called "passwords"
<%
'ConnectionString = "DSN=aspclassifieds;UID=admin;PASSWORD=temp"
%>
To create a system DSN you basically do the
following.
In the Control Panel, double click the icon for the ODBC Datasource Administrator. In Windows 2000, the ODBC Administrator is located under Start Menu|Settings|Control Panel|Administrative Tools.
Click on the System DSN tab, then click Add. Select the Microsoft Access Driver and click Finish. You will now see a select database dialog. Enter the desired DSN in the Datasource name field.
You can leave the description blank or put something there if you want. It
doesn't matter. Now click on the Select button, then browse down to find the location of the web you have recently created. The path should be
something like C:\inetpub\wwwroot\myweb. Once you locate the web's directory, continue to browse until you find the database for this web
(inetpub\wwwroot\myweb\_database\passwords.mdb) When you open the folder the
database is in the MDB file will appear to the left. Select the MDB file and click ok. Continue to click Ok until you have closed
all open windows.
Remember that you will have to ask the server admins to create this for you if
you do not have direct access to the server.
They may prefer that you simply use a DSN-LESS connection and may not be willing
to do this.
DSN-LESS Connection
If using a DSN-LESS connection you cannot use Server.MapPath. You must put in
the physical path to the database like so.
<%
ConnectionString = "DBQ=C:\Inetpub\wwwroot\aspclassifieds\_database\aspclassifieds.mdb;Driver={Microsoft Access Driver
(*.mdb)};UID=admin;PASSWORD=temp"
%>
You cannot specify the physical path using http
syntax like this.
This is
an example on what not to do.
<%
ConnectionString = "DBQ=http//www.mysite.com/_database/aspclassifieds.mdb;Driver={Microsoft Access Driver
(*.mdb)};UID=admin;PASSWORD=temp"
%>
This is
an example on what not to do.
It just doesn't work that way so don't even try it.
The reason you cannot use
Server.MapPath when specifying the data path for the DSN-LESS connection is is because the "dataconn_inc.asp"
file is included in many pages spanning different directories. Therefore if you run
a page from a subdirectory the datapath will end up different then a
page run from a directory below it. It is because of the way
Server.MapPath works.
IMPORTANT
It is very important that permissions are set on
the directory the database is in.
Click here to read about permissions and how they
are set.
Also, since this code is accessing a database your system needs to
have the proper ODBC drivers installed. Most systems will already have
this installed but if you need to install the drivers or get updated
drivers please go to the
following site.
http://www.microsoft.com/data/
Look for the MDAC download.
Disclaimer... www.ASPClassifieds.com makes no guarantee about the security this script offers. Use this at your own risk. To the best of knowledge it is very secure, but that doesn't mean there isn't a bug or some hacker will never find a way into it. We recommend you rigorously test it and change the password on the Access database before you start using this. That way if someone downloads your database they will a hard time getting anything useful out of it especially since the database supplied with this download is also encrypted. There are utilities available to crack Access database's so if you really want secure password protection you should port this to a SQL database. If using Access and your web is frontpage enabled you can right click on a folder in frontpage explorer and choose properties, this will allow you to uncheck "allow files to be browsed" which will stop people from downloading your Access database if they somehow figure out the URL.