%@ Language=VBScript %>
<%
response.expires = 0
response.expiresabsolute = Now() -1
response.addHeader "pragma","no-cache"
response.addHeader "cache-control","private"
Response.CacheControl = "no-cache"
Server.ScriptTimeout = 300
%>
<%
Function OpenDatabase()
Dim connRTO
' Open a connection to the database.
Set connRTO = Server.CreateObject("ADODB.Connection")
connRTO.Open "Data Source=rtosoft_web;User ID=rtosoft_webadmin;Password=Heather8;"
' Return the database connection.
Set OpenDatabase = connRTO
End Function
Function OpenLicenseDatabase()
Dim connLicense
' Open a connection to the license database.
Set connLicense = Server.CreateObject("ADODB.Connection")
connLicense.Open "Data Source=rtosoft_license;User ID=rtosoft_licadmin;Password=Heather8;"
' Return the license database connection.
Set OpenLicenseDatabase = connLicense
End Function
%>
<%
response.expires = 0
response.expiresabsolute = Now() -1
response.addHeader "pragma","no-cache"
response.addHeader "cache-control","private"
Response.CacheControl = "no-cache"
Server.ScriptTimeout = 300
%>
<%
Sub AddFullContact(connRTO, strPrefix, strFirstName, strLastName, strCompany, strTitle, strStreet1, strStreet2, strCity, nState, strPostalCode, nCountry, strEmail, strPhone, strFax, strURL)
Dim recContact, strSQL
' Check to see if the contact is already in the database. If so, update the contact.
Set recContact = GetContactByEmail(connRTO, strEmail)
if (not recContact.EOF) then
strSQL = "update Contacts set Prefix='" & Replace(LTrim(strPrefix), "'", "''") & _
"',FirstName='" & Replace(LTrim(strFirstName), "'", "''") & _
"',LastName='" & Replace(LTrim(strLastName), "'", "''") & _
"',CompanyName='" & Replace(LTrim(strCompany), "'", "''") & _
"',Title='" & Replace(LTrim(strTitle), "'", "''") & _
"',Street1='" & Replace(LTrim(strStreet1), "'", "''") & _
"',Street2='" & Replace(LTrim(strStreet2), "'", "''") & _
"',City='" & Replace(LTrim(strCity), "'", "''") & _
"',State='" & nState & _
"',PostalCode='" & Replace(LTrim(strPostalCode), "'", "''") & _
"',Country='" & nCountry & _
"',PhoneNumber='" & Replace(LTrim(strPhone), "'", "''") & _
"',FaxNumber='" & Replace(LTrim(strFax), "'", "''") & _
"',URL='" & Replace(LTrim(strURL), "'", "''") & _
"' where EmailAddress='" & Replace(LTrim(strEmail), "'", "''") & "'"
' Otherwise, create a new contact in the database.
else
strSQL = "insert into Contacts (Prefix,FirstName,LastName,CompanyName,Title,Street1,Street2,City,State,PostalCode,Country,EmailAddress,PhoneNumber,FaxNumber,URL) values ('" & _
Replace(LTrim(strPrefix), "'", "''") & "','" & _
Replace(LTrim(strFirstName), "'", "''") & "','" & _
Replace(LTrim(strLastName), "'", "''") & "','" & _
Replace(LTrim(strCompany), "'", "''") & "','" & _
Replace(LTrim(strTitle), "'", "''") & "','" & _
Replace(LTrim(strStreet1), "'", "''") & "','" & _
Replace(LTrim(strStreet2), "'", "''") & "','" & _
Replace(LTrim(strCity), "'", "''") & "','" & _
nState & "','" & _
Replace(LTrim(strPostalCode), "'", "''") & "','" & _
nCountry & "','" & _
Replace(LTrim(strEmail), "'", "''") & "','" & _
Replace(LTrim(strPhone), "'", "''") & "','" & _
Replace(LTrim(strFax), "'", "''") & "','" & _
Replace(LTrim(strURL), "'", "''") & "')"
end if
' Execute the SQL query.
connRTO.Execute strSQL
End Sub
Sub AddSimpleContact(connRTO, strPrefix, strFirstName, strLastName, strCompany, strEmail, strPhone)
Dim recContact, strSQL
' Check to see if the contact is already in the database. If so, update the contact.
Set recContact = GetContactByEmail(connRTO, strEmail)
if (not recContact.EOF) then
strSQL = "update Contacts set Prefix='" & Replace(LTrim(strPrefix), "'", "''") & _
"',FirstName='" & Replace(LTrim(strFirstName), "'", "''") & _
"',LastName='" & Replace(LTrim(strLastName), "'", "''") & _
"',CompanyName='" & Replace(LTrim(strCompany), "'", "''") & _
"',PhoneNumber='" & Replace(LTrim(strPhone), "'", "''") & _
"' where EmailAddress='" & Replace(LTrim(strEmail), "'", "''") & "'"
' Otherwise, create a new contact in the database.
else
strSQL = "insert into Contacts (Prefix,FirstName,LastName,CompanyName,EmailAddress,PhoneNumber) values ('" & _
Replace(LTrim(strPrefix), "'", "''") & "','" & _
Replace(LTrim(strFirstName), "'", "''") & "','" & _
Replace(LTrim(strLastName), "'", "''") & "','" & _
Replace(LTrim(strCompany), "'", "''") & "','" & _
Replace(LTrim(strEmail), "'", "''") & "','" & _
Replace(LTrim(strPhone), "'", "''") & "')"
end if
' Execute the SQL query.
connRTO.Execute strSQL
End Sub
Function GetContactByID(connRTO, nID)
Dim recContact
' Get the contact with the given ID from the database.
Set recContact = Server.CreateObject("ADODB.Recordset")
recContact.Open ("select * from Contacts where ID='" & nID & "'"), connRTO
' Return the contact record.
Set GetContactByID = recContact
End Function
Function GetContactByEmail(connRTO, strEmail)
Dim recContact
' Get the contact with the given e-mail address from the database.
Set recContact = Server.CreateObject("ADODB.Recordset")
recContact.Open ("select * from Contacts where EmailAddress='" & Replace(LTrim(strEmail), "'", "''") & "'"), connRTO
' Return the contact record.
Set GetContactByEmail = recContact
End Function
%>
<%
Response.Expires = 0
Dim strProduct, strPrefix, strFirstName, strMiddleName, strLastName, strSuffix, strCompanyName, strTitle, strStreet1, strStreet2, strCity, strState, strPostalCode, strCountry, strEmailAddress, strPhoneNumber, strFaxNumber, strURL
' Save the defaults.
strPrefix = "Mr."
strState = "0"
strCountry = "223"
strProduct = Request.QueryString("ProductID")
if (strProduct = "") then
strProduct = "1"
end if
' Retrieve the contact information from the database based on the cached contact ID.
if (Request.Cookies("Contact")("ID") <> "") then
' Open the database.
Set connRTO = OpenDatabase
' Retrieve the contact record from the database.
Set recContact = GetContactByID(connRTO, Request.Cookies("Contact")("ID"))
if (Not recContact.EOF) then
' Store off the contact info.
strPrefix = recContact("Prefix")
strFirstName = recContact("FirstName")
strMiddleName = recContact("MiddleName")
strLastName = recContact("LastName")
strSuffix = recContact("Suffix")
strCompanyName = recContact("CompanyName")
strTitle = recContact("Title")
strStreet1 = recContact("Street1")
strStreet2 = recContact("Street2")
strCity = recContact("City")
strState = recContact("State")
strPostalCode = recContact("PostalCode")
strCountry = recContact("Country")
strEmailAddress = recContact("EMailAddress")
strPhoneNumber = recContact("PhoneNumber")
strFaxNumber = recContact("FaxNumber")
strURL = recContact("URL")
if ((strCountry <> "223") AND (strCountry <> "38")) then
strState = "0"
end if
end if
' Close the database.
recContact.Close
Set recContact = Nothing
connRTO.Close
Set connRTO = Nothing
end if
%>
RTO Software - TScale - View Online Demo
Updated White Paper: Conquering Rogue Application Behavior
Are your applications using too many CPU resources?
Download the white paper
 
"I recommend RTO TScale to Microsoft Terminal Server and Citrix administrators who are supporting memory hungry applications for their user population"
-Jim Kenzig
Cuyaghoga County Public Library
© Copyright
2007-2011. RTO Software. All rights reserved.