Prva così:
codice:
<html>
<head>
<title>Registrazio digitate ne al sito di Fiel_TV</title>
<%
submit = Request.ServerVariables("REQUEST_METHOD")="POST"
pagina=Request.ServerVariables("PATH_INFO")
errore=False
If submit Then
nick=TRIM(Request.Form("nick"))
passw=TRIM(Request.Form("passw"))
email=TRIM(Request.Form("email"))
liv_ut=TRIM(Request.Form("liv_ut"))
If len(nick) = 0 Then
errore=True
messaggio=messaggio& "Il nick è un campo obbligatorio!
"
End If
If len(passw) = 0 Then
errore=True
messaggio=messaggio& "La password è un campo obbligatorio!
"
End If
If len(repassw) = 0 Then
errore=True
messaggio=messaggio& "Ridigita la password!
"
End If
If len(email) = 0 Then
errore=True
messaggio=messaggio& "La E-mail è un campo obbligatorio!
"
End If
If Len (passw) >0 And len (repassw) >0 Then
If StrComp(passw,repassw,0)<>0 Then
errore=True
messaggio=messaggio&"Le password non coincidono!
"
End If
End If
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & server.MapPath("../mdb-database/utenti.mdb")
If Not errore Then
nick=Replace(nick,"","")
sql="select nick from utenti where nick=""& nick&"""
Set Rs=Conn.Execute(sql)
If Not Rs.EOF Then
errore=True
messaggio="Il nick scelto è già occupato
"
End If
If Not errore Then
passw=Replace(passw,"","")
email=Replace(email,"","")
sql="Insert into utenti"&_
"(nick,passw,email)"&_
"VALUES("'&nick&'","'&passw&'","'&email&"')"
Conn.Execute(sql)
messaggio="Registrazione eseguita con successo!"
End If
Conn.Close
Set Conn=Nothing
End If
end if
%>
</body>
</head>
</html>
<html>
<head>
<title>REGISTRAZIONE UTENTE</title>
</head>
<body>
<%If Not submit Then %>
<form name="registrazione" method="post" action="<%=pagina%>"">
<table width="200" border="1" align="center">
<tr>
<td><div align="center">nick
<input type="text" name="nick">
</div></td>
<td><div align="center">passw
<input type="text" name="passw">
</div></td>
</tr>
<tr>
<td><div align="center">ridigita password
<input type="password" name="repassw">
</div></td>
<td><div align="center">email
<input type="text" name="email">
</div></td>
</tr>
<tr>
<td><div align="center">
<input type="submit" value="Registra">
</div></td>
<td><div align="center">
<input type="reset" name="Submit" value="Cancella">
</div></td>
</tr>
</table>
<input name="liv_ut" type="hidden" value="">
</form>
<%Else%>
<%=messaggio%>
<%If errore Then%>
Correggi
<%End If%>
(L.117)<%End If%>
</body>
</html>