<%
Call fh_Main()
Sub fh_Main()
Dim dbPath, propFile, XML, dbFields, tableHead, allTHeads, Uploader, propValue, fieldName, fieldValue, errEvent
Dim CustErr, errFlag, path, info, rowRec, objMail
on error resume next
Set Uploader = New FileUploader
Uploader.Upload()
propFile = "FormsHandler.xml"
set XML = fhOpenXMLFile(Server.MapPath(propFile))
Dim comp
if XML is nothing then
Call fhRaiseFatalError(601)
Response.End
else
set comp = fhGetNode(XML,,"Component", Array("name","id"), Array("formshandler", Uploader.form("componentid")), -1)
end if
if comp is Nothing then
Call fhRaiseFatalError(400)
set Xml = nothing
Response.End
end if
dbFields = fhGetDBFields(comp)
if LCase(fhGetProperty(comp,"writetodb")) = "true" then
dbPath = fhGetProperty(comp, "dbpath")
if dbPath = "" then
'the db path was not set
fhRaiseFatalError("526")
Response.End
end if
if not inStr(1, dbPath, "\", 1) > 0 then
dbPath= Server.MapPath(dbPath)
end if
if fhFileExist(dbPath) then
'check if the fields are the same
tableHead = fhGetLine(dbPath)
if LCase(dbFields) <> LCase(tableHead) then
'create the database
fhCreateDB dbPath, dbFields
if (Err.Number <> 0) Then
Call fhRaiseFatalError(Err.Number)
set comp = nothing
set Xml = nothing
Response.End
end if
tableHead = fhGetLine(dbPath)
end if
else
'create the database
fhCreateDB dbPath, dbFields
if (Err.Number <> 0) Then
Call fhRaiseFatalError(Err.Number)
set comp = nothing
set Xml = nothing
Response.End
end if
tableHead = fhGetLine(dbPath)
end if
else
tableHead = dbFields
end if
allTHeads = split(tableHead,",")
%>