The previous three pages have been basic scene setting pages. I have several major systems out there on the Public Internet and on Private Intranets. These use the SST Data Mirroring described in this story.

One of the systems is SST ContactsPlus (it is used for many purposes ranging from a Personal Address book for one individual to a major Client Management System). First let me give you some idea of the scale of the system.

I do not give these statistics out of any sense of boastfullness, nor to impress you. It is really to allow you to see that managing and maintaining the system (as opposed to the data) is a seriously significant task. It therefore needs to be structured and carefully controlled.

So the Active Server Page that we constructed on the previous page of this story only bears a slight resemblance to the real life web pages in the system.

If such a page did exist, it would look like the example shown below.



<%

if SESSION( "STAFF_CODE") = "" then
	Response.Write "<IFRAME NAME='main_frame' Width='740' height='280' scrolling='auto' src='re-logon.asp'>"
	Response.End
end if

%>
<!--#include file="mailserver.asp"-->
<!--#include file="directory.asp"-->
<!--#include file="language.asp"-->
<!--#include file="contact_routines.asp"-->
<%
cCapabilityNeeded = ""
%>
<!--#include file="check_authority.asp"-->
<!--#include file="record_hits.asp"-->


<%

session.LCID = 2057


'''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''
'''                                           '''
'''                                           '''
'''  This section validates the data input.   '''
'''                                           '''
'''                                           '''
'''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''

if Request.Form("surname") = "" then
	Response.Write "Surname must be present.<BR>"
	Response.Write "Click on back in your Browser and try again"
	Response.End
end if


'''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''
'''                                           '''
'''                                           '''
'''  This section records the data input.     '''
'''                                           '''
'''                                           '''
'''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''

if Request.Form("public_cb") = "on" then
    lPublic = True
else
    lPublic = False
end if


    SQLStr = "INSERT INTO name ("

    SQLStr = SQLStr & "Title, "
    SQLStr = SQLStr & "Forenames, "
    SQLStr = SQLStr & "Surname, "
    SQLStr = SQLStr & "Honours, "
    SQLStr = SQLStr & "PublicInfo"

    SQLStr = SQLStr & ") values ("

    SQLStr = SQLStr & "'" & Replace(Request.Form("TITLE"), "'", "''") & "', "
    SQLStr = SQLStr & "'" & Replace(Request.Form("FORENAMES"), "'", "''") & "', "
    SQLStr = SQLStr & "'" & Replace(Request.Form("SURNAME"), "'", "''") & "', "
    SQLStr = SQLStr & "'" & Replace(Request.Form("HONOURS"), "'", "''") & "', "
    SQLStr = SQLStr & " " & lPublic & ")"

''Response.Write SQLStr
''Response.End

    Set oRS = Con.Execute( SQLStr )

%>


Your Name Details have been recorded
<BR>
Thank you !!




		

If you study the script, you will see that a new block has been added at the top. You will also see that the Connection String has been removed from the the original script.

It is the new stuff at the top that this page in the story is about.




<%

if SESSION( "STAFF_CODE") = "" then
	Response.Write "<IFRAME NAME='main_frame' Width='740' height='280' scrolling='auto' src='re-logon.asp'>"
	Response.End
end if

%>

		

The system uses SESSION VARIABLES (and therefore by implication, TRANSIENT COOKIES). When a user successfully Logs In to the system, his/her STAFF_CODE is recorded as a SESSION VARIABLE. If no use is made of the system, the variable will expire. When it does expire, the re-logon.asp web page is shown and the user made to log on again.

This is an elementary, simple to use security measure.


Next a file called mailserver.asp is included. It contains something like:-



<%

cMailServer	= "mail.mymailsever.net"
cAdminFromName	= "Fred Smith - for the XXX plc"
cAdminFromEMail	= "fred.smith@xxx.com"

%>

		

The data in here could be hard coded in lots of pages that send EMails. When you have had to go through creating lots of copies of a site, having to change lots of Web Pages, You very rapidly decide that an 'Include' file is needed !!


Next a file called directory.asp is included. It contains something like:-



<%


dataBaseRoot = "C:\Inetpub\wwwroot\contacts\"
dataLogBaseRoot = "F:\somewhere_else\"

%>

		

I have had to move web sites many times - either to create a new one for a new customer, or because a server has 'blown-up', or an ISP changes the Web Server - usually at very short notice. It is so, so easy to simply change the contents of the directory.asp file.

It means that the Connection String changes from:



DBCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=c:\inetpub\wwwroot\contacts\data\contacts.mdb"

		

To:



DBCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & dataBaseRoot & "data\contacts.mdb"

		

The reason for the change is obvious !!


Next a file called language.asp is included. It can either contain a hard coded language like this:


<%


cLanguage = "en-gb"

%>

		

or


<%


cLanguage = Request.ServerVariables("HTTP_ACCEPT_LANGUAGE")

%>

		

which gets it from the Clients Browser.

The cLanguage variable is used to select the language for any error messages that the system delivers.


Next a file called contact_routines.asp is included. It contains dozens of standard functions that are used in two or more web pages in the system.

It starts out with the following:



<!--#include file="dbconnections.asp"-->
<%

session.LCID = 2057


%>

		

The dbconnections.asp establishes lots of connections (sort-of one for each table in the databases)

It also contains a bit of script that generates a variable called cNow which is used to defeat the tendency for the system to believe that the first 9 days of each month should be treated as mm/dd/yyyy format and the rest of the month as dd/mm/yyyy !!!


The remainder of the new top block


Hopefully, you now have an idea of the scale and structured approach


In the past, I have written such stories on one web page. One of the readers printed one out on paper - the paper was over fifty foot long. This time, Im using several pages to make it easier for readers to deal with. This page is just an Introduction to set the scene.

An index and links to the other pages is given below.