I can't post all of the code. I will have to two part it.
<%
const veCharsNotValid = 1
const veIsRequired = 2
const veIsLongerThanMaxlength = 3
const vePasswordsAreDifferent = 4
const veIsNotNumeric = 5
const veIsNumericButNotLong = 6
const veIsGreaterThanMax = 7
const veIsLessThanMin = 8
const veIsDuplicated = 9
const veIsNumericButNotDouble = 10
const veFormatIsInvalid = 11
const veIsNumericButNotYMD = 12
function convertmasmenos(parametro)
' Convierte los signos < y > de la string de entrada parametro en sus equivalentes HTML
while instr(1, parametro, "<") > 0
parametro = left(parametro, instr(1, parametro, "<")-1) & "<" & mid(parametro, instr(1, parametro, "<")+1)
wend
while instr(1, parametro, ">") > 0
parametro = left(parametro, instr(1, parametro, ">")-1) & ">" & mid(parametro, instr(1, parametro, ">")+1)
wend
convertmasmenos = parametro
end function
function toHTML(header, antesenter, memo, despuesenter, footer, sivacio, sacarmayormenor, nullparagraph)
dim contador
dim contador_parrafos
dim respuesta
dim al
if sacarmayormenor then
memo = convertmasmenos(memo)
end if
contador = 1
contador_parrafos = 0
respuesta = ""
while contador < len(memo)
al = instr(contador, memo, chr(13) & chr(10))
if respuesta = "" and header <> "" then
respuesta = header
else
respuesta = respuesta & antesenter
end if
if al = 0 then
respuesta = respuesta & mid(memo, contador) & despuesenter & footer
' Imprimir parrafo e irme
contador = contador + 99999
else
if al = contador and nullparagraph = true then
respuesta = respuesta & " " & despuesenter
else
respuesta = respuesta & mid(memo, contador, al-contador) & despuesenter
end if
' Imprimir parrafo
contador = al + 2
end if
contador_parrafos = contador_parrafos + 1
wend
tohtml = inif(respuesta = "", sivacio, respuesta)
end function
function IntelligentToHTMLInternal(header, antesenter, memo, despuesenter, footer, sivacio, sacarmayormenor, nullparagraph)
dim contador
dim contador_parrafos
dim respuesta
dim al
if sacarmayormenor then
memo = convertmasmenos(memo)
end if
contador = 1
contador_parrafos = 0
respuesta = ""
while contador < len(memo)
al = instr(contador, memo, chr(13) & chr(10))
if respuesta = "" then
respuesta = header
else
respuesta = respuesta & antesenter
end if
if al = 0 then
respuesta = respuesta & mid(memo, contador) & footer
' Imprimir parrafo e irme
contador = contador + 99999
else
if al = contador and nullparagraph = true then
respuesta = respuesta & " " & despuesenter
else
respuesta = respuesta & mid(memo, contador, al-contador) & despuesenter
end if
' Imprimir parrafo
contador = al + 2
end if
contador_parrafos = contador_parrafos + 1
wend
IntelligentToHTMLInternal = inif(respuesta = "", sivacio, respuesta)
end function
function IntelligentToHTML(header, antesenter, memo, despuesenter, footer, sivacio, sacarmayormenor, nullparagraph)
dim parser
dim respuesta
set parser = server.CreateObject("LOGSuper.ParserMain")
parser.UpcaseParametro = false
parser.UpcaseTag = false
parser.UpcaseTexto = false
parser.TagComienzo = "<html>"
parser.TagFin = "</html>"
parser.SeparacionParametros = chr(250) & chr(180) & chr(200) & chr(220)
parser.Limit = 200
parser.Parsear cstr(nulltoempty(memo))
dim texto
dim IterationElemento
dim last
last = -1
for each IterationElemento in parser.Elementos
if IterationElemento.Tipo = 1 then
respuesta = respuesta & IterationElemento.Contenido
on error resume next
respuesta = respuesta & " " & IterationElemento.Parametros(1).valor
on error goto 0
last = 0
else
if IterationElemento.Contenido <> "" then
if memo <> "" and last = -1 then
if header = "" then
respuesta = antesenter
else
respuesta = header
end if
end if
if last = 0 and left(IterationElemento.contenido, len(vbcrlf)) = vbcrLf then
respuesta = respuesta & antesenter
texto = mid(iterationelemento.contenido, len(vbcrlf)+1)
else
texto = iterationelemento.contenido
end if
respuesta = respuesta & IntelligentToHTMLInternal("", antesenter, texto, despuesenter, "", "", sacarmayormenor, nullparagraph)
last = 1
end if
end if
next
if last = 1 then
respuesta = respuesta & despuesenter
end if
if memo <> "" then
respuesta = respuesta & footer
end if
set parser = nothing
IntelligentToHTML = inif(respuesta = "", sivacio, respuesta)
end function
function inif(condicion, verdadero, falso)
if condicion then
inif = verdadero
else
inif = falso
end if
end function
function inif1(condicion, verdadero)
inif1 = inif(condicion, verdadero, "")
end function
function inif3(condicion1, valorsi1, condicion2,valorsi2, valorsi3)
if condicion1 then
inif3 = valorsi1
elseif condicion2 then
inif3 = valorsi2
else
inif3 = valorsi3
end if
end function
function inifrcs(condicion, camporcs1, camporcs2, rcs)
if condicion then
inifrcs = rcs(camporcs1)
else
inifrcs = rcs(camporcs2)
end if
end function
function max(valor1, valor2)
max = inif(valor1>valor2, valor1, valor2)
end function
function min(valor1, valor2)
min = inif(valor1<valor2, valor1, valor2)
end function
function emptytonull(parametro)
emptytonull = inif(parametro="", null, parametro)
end function
function nulltoempty(parametro)
nulltoempty = inif(isnull(parametro), "", parametro)
end function
function zerotonull(parametro)
if isnumeric(parametro) then
zerotonull = inif(parametro=0, null, parametro)
else
zerotonull = null
end if
end function
function nulltozero(parametro)
nulltozero = inif(isnull(parametro), 0, parametro)
end function
function nbsp(parametro)
nbsp = inif(nulltoempty(parametro)="", " ", parametro)
end function
function nullto(parametro, valor)
if isnull(parametro) then
nullto = valor
else
nullto = parametro
end if
end function
function emptyto(parametro, valor)
if parametro="" then
emptyto = valor
else
emptyto = parametro
end if
end function
function extension(filename)
if instrrev(filename, ".") = 0 then
extension = ""
else
extension = mid(filename, instrrev(filename, ".") + 1)
end if
end function
function SQLValidRequestParameter(parametro)
dim i
dim c
dim respuesta
respuesta = true
for i = 1 to len(parametro)
c = mid(parametro, i, 1)
if not ((c >= "A" and c <= "Z") or (c="_") or (c >= "0" and c <= "9") or (c >= "a" and c <= "z") or (c=".") or (c="-") or (c="@")) then
respuesta = false
exit for
end if
next
SQLValidRequestParameter = respuesta
end function
function SQLRestrictedValidRequestParameter(parametro)
dim i
dim c
dim respuesta
respuesta = true
for i = 1 to len(parametro)
c = mid(parametro, i, 1)
if not ((c >= "A" and c <= "Z") or (c="_") or (c >= "0" and c <= "9") or (c >= "a" and c <= "z") or (c=".") or (c="-")) then
respuesta = false
exit for
end if
next
SQLRestrictedValidRequestParameter = respuesta
end function
function SQLUnrestrictedValidRequestParameter(parametro)
dim i
dim c
dim respuesta
respuesta = true
for i = 1 to len(parametro)
c = mid(parametro, i, 1)
if c="'" or c="%" or c="""" or c="*" then
respuesta = false
exit for
end if
next
SQLUnrestrictedValidRequestParameter = respuesta
end function
function SQLIntValidRequestParameter(parametro)
dim i
dim c
dim respuesta
respuesta = true
for i = 1 to len(parametro)
c = asc(mid(parametro, i, 1))
if not (c >= 48 and c <= 57) then
respuesta = false
exit for
end if
next
SQLIntValidRequestParameter = respuesta and (parametro <> "")
end function
function SQLIntOrEmptyValidRequestParameter(parametro)
dim i
dim c
dim respuesta
respuesta = true
for i = 1 to len(parametro)
c = asc(mid(parametro, i, 1))
if not (c >= 48 and c <= 57) then
respuesta = false
exit for
end if
next
SQLIntOrEmptyValidRequestParameter = respuesta
end function
function ToSQLNumber(parametro)
dim i
dim c
dim respuesta
dim parametro2
respuesta = ""
parametro2 = trim(cstr(parametro))
for i = 1 to len(parametro2)
c = asc(mid(parametro2, i, 1))
if (c >= 48 and c <= 57) then
respuesta = respuesta & chr(c)
elseif c = 44 or c = 46 then
respuesta = respuesta & "."
else
respuesta = ""
exit for
end if
next
ToSQLNumber = inif(len(parametro2) = 0, "", respuesta)
end function
function RcsStringExist(con, SQL, Field, Valor)
dim rcs
set rcs = server.CreateObject("ADODB.Recordset")
rcs.Open SQL, con
if Field <> "" and Valor <> "" then
rcs.Filter = Field & "='" & Valor & "'"
end if
RcsStringExist = not rcs.EOF
rcs.Close
set rcs = nothing
end function
function CheckIfHTML(Texto)
CheckIfHTML = left(ucase(trim(Texto)),6) = "<HTML>" and right(ucase(trim(Texto)),7) = "</HTML>"
end function
function GetHTML(Texto)
dim enc
enc = instr(1, Texto, "<html>")
if enc = 0 then
GetHTML = texto
else
GetHTML = mid(texto, enc+6, instr(1, texto, "</html>")-(enc+6))
end if
end function