codice:
<%
if IsValidString2(request.form("username")) then
if IsValidString2(request.form("password")) then
userpwok = "S"
else
userpwok = "N"
errore2 = "
• Hai utilizzato dei caratteri non consentiti !#$%^&*=+{}[]()|\;:/?>,<'.
o uno spazio "" nel campo password"
end if
else
if IsValidString2(request.form("password")) then
userpwok = "N"
errore2 = "
• Hai utilizzato dei caratteri non consentiti !#$%^&*=+{}[]()|\;:/?>,<'.
o uno spazio "" nel campo username"
else
userpwok = "N"
errore2 = "
• Hai utilizzato dei caratteri non consentiti !#$%^&*=+{}[]()|\;:/?>,<'.
o uno spazio "" nei campi username e password"
end if
end if
%>
<%
if IsValidString(request.form("nome") & request.form("email") & request.form("citta") & request.form("statocivile") & request.form("prefcell") & request.form("numcell") & request.form("icq") & request.form("msn")) then
campivalidi = "S"
else
campivalidi = "N"
errore1 = "
• Hai utilizzato dei caratteri non consentiti !#$%^&*=+{}[]|\;:/?>,<
oppure hai inserito un doppio spazio "" o doppia virgola ",,"
in uno dei seguenti campi: nome, email, città, stato civile, cellulare, icq, msn"
end if
%>
<%
' controllo se user e mail inserite non siano già presenti
if userpwok = "S" and campivalidi = "S" then
Dim rsCheck
Set rsCheck = Server.CreateObject("ADODB.Recordset")
rsCheck.ActiveConnection = MM_conn_STRING
rsCheck.Source = "SELECT User, Mail FROM TblIscritto WHERE User = '" & request.Form("username") & "' OR Mail = '" & request.Form("email") & "'"
rsCheck.CursorType = 0
rsCheck.CursorLocation = 2
rsCheck.LockType = 1
rsCheck.Open()
if not rsCheck.EOF and not rsCheck.BOF then
if Ucase(rsCheck("User")) = Ucase(request.Form("username")) then
if Ucase(rsCheck("Mail")) = Ucase(request.Form("email")) then
esiste = "S"
errore3 = "
• Username ed e-mail già presenti nel database"
else
esiste = "S"
errore3 = "
• Username già presente nel database"
end if
else
if Ucase(rsCheck("Mail")) = Ucase(request.Form("email")) then
esiste = "S"
errore3 = "
• E-mail già presente nel database"
end if
end if
else
esiste = "N"
end if
rsCheck.Close()
Set rsCheck = Nothing
end if
%>
<%
if request.form("giorno") <> "nd" AND request.form("mese") <> "nd" AND request.form("anno") <> "nd" then
giorno = request.form("giorno")
if giorno < 10 then
giornoN = 0 & giorno
else
giornoN = giorno
end if
mese = request.form("mese")
if mese < 10 then
meseN = 0 & mese
else
meseN = mese
end if
annoN = request.form("anno")
nascitacheck = giornoN & "/" & meseN & "/" & annoN
nascita = annoN & meseN & giornoN
else
nascitacheck = Date()
end if
if IsDate(nascitacheck) then
okdata = "S"
else
okdata = "N"
errore4 = "
• Hai inserito una data di nascita non valida, ad esempio 30 febbraio"
end if
%>
<%
if Len(request.Form("username")) < 4 then
if Len(request.Form("password")) < 5 then
oklunghezza = "N"
errore5 = "
• Username inferiore a 4 caratteri e password inferiore a 5"
else
oklunghezza = "N"
errore5 = "
• Username inferiore a 4 caratteri"
end if
else
if Len(request.Form("password")) < 5 then
oklunghezza = "N"
errore5 = "
• Password inferiore a 5 caratteri"
else
oklunghezza = "S"
end if
end if
if Ucase(request.Form("username")) = Ucase(request.Form("password")) then
uguali = "S"
errore6 = "
• Non è consentito inserire username e password uguali"
else
uguali = "N"
end if
%>
<%
if request.Form("prefcell") <> "" and request.Form("numcell") <> "" then
okcell = "S"
end if
%>
<%
function iscrizione()
if campivalidi="S" and userpwok = "S" and esiste = "N" and okdata = "S" and oklunghezza = "S" and uguali = "N" then
returnValue = true
else
returnValue = false
end if
iscrizione= returnValue
end function
%>
<%
if iscrizione() then
%>
<%
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editQuery
MM_editConnection = MM_conn_STRING
if nascitacheck <> Date() then
if request.Form("segno") <> "nd" then
if okcell = "S" then
MM_editQuery = "insert into TblIscritto (User,Pass,Nome,Cognome,Mail,ICQ,MSN,AnnoNascita,SegnoZodiacale,Citta,Sesso,StatoCivile,CellPrefisso,CellNumero,MostraCell,RegIP,DataIscrizione) values ('" & request.form("username") & "','" & request.form("password") & "','" & request.form("nome") & "','" & request.form("cognome") & "','" & request.form("email") & "','" & request.form("icq") & "','" & request.form("msn") & "','" & nascita & "','" & request.form("segno") & "','" & request.form("citta") & "','" & request.form("sesso") & "','" & request.form("statocivile") & "','" & request.form("prefcell") & "','" & request.form("numcell") & "','" & request.form("mostracell") & "','" & request.form("ip") & "','" & request.form("data") & "')"
else
MM_editQuery = "insert into TblIscritto (User,Pass,Nome,Cognome,Mail,ICQ,MSN,AnnoNascita,SegnoZodiacale,Citta,Sesso,StatoCivile,RegIP,DataIscrizione) values ('" & request.form("username") & "','" & request.form("password") & "','" & request.form("nome") & "','" & request.form("cognome") & "','" & request.form("email") & "','" & request.form("icq") & "','" & request.form("msn") & "','" & nascita & "','" & request.form("segno") & "','" & request.form("citta") & "','" & request.form("sesso") & "','" & request.form("statocivile") & "','" & request.form("ip") & "','" & request.form("data") & "')"
end if
else
if okcell = "S" then
MM_editQuery = "insert into TblIscritto (User,Pass,Nome,Cognome,Mail,ICQ,MSN,AnnoNascita,Citta,Sesso,StatoCivile,CellPrefisso,CellNumero,MostraCell,RegIP,DataIscrizione) values ('" & request.form("username") & "','" & request.form("password") & "','" & request.form("nome") & "','" & request.form("cognome") & "','" & request.form("email") & "','" & request.form("icq") & "','" & request.form("msn") & "','" & nascita & "','" & request.form("citta") & "','" & request.form("sesso") & "','" & request.form("statocivile") & "','" & request.form("prefcell") & "','" & request.form("numcell") & "','" & request.form("mostracell") & "','" & request.form("ip") & "','" & request.form("data") & "')"
else
MM_editQuery = "insert into TblIscritto (User,Pass,Nome,Cognome,Mail,ICQ,MSN,AnnoNascita,Citta,Sesso,StatoCivile,RegIP,DataIscrizione) values ('" & request.form("username") & "','" & request.form("password") & "','" & request.form("nome") & "','" & request.form("cognome") & "','" & request.form("email") & "','" & request.form("icq") & "','" & request.form("msn") & "','" & nascita & "','" & request.form("citta") & "','" & request.form("sesso") & "','" & request.form("statocivile") & "','" & request.form("ip") & "','" & request.form("data") & "')"
end if
end if
else
if request.Form("segno") <> "nd" then
if okcell = "S" then
MM_editQuery = "insert into TblIscritto (User,Pass,Nome,Cognome,Mail,ICQ,MSN,SegnoZodiacale,Citta,Sesso,StatoCivile,CellPrefisso,CellNumero,MostraCell,RegIP,DataIscrizione) values ('" & request.form("username") & "','" & request.form("password") & "','" & request.form("nome") & "','" & request.form("cognome") & "','" & request.form("email") & "','" & request.form("icq") & "','" & request.form("msn") & "','" & request.form("segno") & "','" & request.form("citta") & "','" & request.form("sesso") & "','" & request.form("statocivile") & "','" & request.form("prefcell") & "','" & request.form("numcell") & "','" & request.form("mostracell") & "','" & request.form("ip") & "','" & request.form("data") & "')"
else
MM_editQuery = "insert into TblIscritto (User,Pass,Nome,Cognome,Mail,ICQ,MSN,SegnoZodiacale,Citta,Sesso,StatoCivile,RegIP,DataIscrizione) values ('" & request.form("username") & "','" & request.form("password") & "','" & request.form("nome") & "','" & request.form("cognome") & "','" & request.form("email") & "','" & request.form("icq") & "','" & request.form("msn") & "','" & request.form("segno") & "','" & request.form("citta") & "','" & request.form("sesso") & "','" & request.form("statocivile") & "','" & request.form("ip") & "','" & request.form("data") & "')"
end if
else
if okcell = "S" then
MM_editQuery = "insert into TblIscritto (User,Pass,Nome,Cognome,Mail,ICQ,MSN,Citta,Sesso,StatoCivile,CellPrefisso,CellNumero,MostraCell,RegIP,DataIscrizione) values ('" & request.form("username") & "','" & request.form("password") & "','" & request.form("nome") & "','" & request.form("cognome") & "','" & request.form("email") & "','" & request.form("icq") & "','" & request.form("msn") & "','" & request.form("citta") & "','" & request.form("sesso") & "','" & request.form("statocivile") & "','" & request.form("prefcell") & "','" & request.form("numcell") & "','" & request.form("mostracell") & "','" & request.form("ip") & "','" & request.form("data") & "')"
else
MM_editQuery = "insert into TblIscritto (User,Pass,Nome,Cognome,Mail,ICQ,MSN,Citta,Sesso,StatoCivile,RegIP,DataIscrizione) values ('" & request.form("username") & "','" & request.form("password") & "','" & request.form("nome") & "','" & request.form("cognome") & "','" & request.form("email") & "','" & request.form("icq") & "','" & request.form("msn") & "','" & request.form("citta") & "','" & request.form("sesso") & "','" & request.form("statocivile") & "','" & request.form("ip") & "','" & request.form("data") & "')"
end if
end if
end if
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
%>
<%
Dim rsIscritto
Set rsIscritto = Server.CreateObject("ADODB.Recordset")
rsIscritto.ActiveConnection = MM_conn_STRING
rsIscritto.Source = "SELECT IDIscritto, Sesso FROM TblIscritto WHERE Mail = '" & request.Form("email") & "'"
rsIscritto.CursorType = 0
rsIscritto.CursorLocation = 2
rsIscritto.LockType = 1
rsIscritto.Open()
link = rsIscritto("IDIScritto")
if rsIscritto("Sesso") = "F" then
sex = "a"
else
sex = "o"
end if
rsIscritto.Close()
Set rsIscritto = Nothing
' mando la mail coi dati prendendo user e pw dalla form appena inviata
Dim miaMail
Set miaMail = CreateObject("CDONTS.NewMail")
miaMail.From = "info@menesbatto.com"
miaMail.To = request.Form("email")
miaMail.Subject = "menesbatto.com - Iscrizione al sito"
miaMail.BodyFormat = 0
miaMail.MailFormat = 0
miaMail.Body = "testo della mail (omesso per evitar inutile spazio"
miaMail.Send
Set miaMail = Nothing
end if
%>
riassumendo: