io lo fatta così i campi sn diversi ma il succo è lo stesso
ciao ciao
<%@ Language=VBScript %>
<!--#include file="subinclude.inc"-->
<%
Call Main
'---------------------------------------------
Sub Main
Dim dcnDB
Dim strSQL
Dim strErr
strDBPath = Server.MapPath("db\dbXTX.mdb")
Set dcnDB = Server.CreateObject("ADODB.Connection")
dcnDB.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & strDBPath & ";"
Header
if request("action") = "reg" then
strErr = Check(dcnDB)
if strErr = "" then
InsertData dcnDB
ShowPages "ok",dcnDB,""
else
ShowPages "",dcnDB, strErr
end if
else
ShowPages "",dcnDB,""
end if
Footer
dcnDB.Close
End Sub
'---------------------------------------------
Function Check(dcnDB)
Dim rsUser
Dim strSQL
Set rsUser = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM User WHERE Nick = '" & Request.Form("txtNick") & "'"
rsUser.Open strSQL,dcnDB
'Response.Write (strSQL)
if (rsUser.EOF and rsUser.BOF) then
else
Check = "Nome Utente già in uso"
rsUser.Close
Exit Function
end if
rsUser.Close
strSQL = "SELECT * FROM User WHERE Mail = '" & Request.Form("txtMail") & "'"
rsUser.Open strSQL,dcnDB
'Response.Write (strSQL)
if (rsUser.EOF and rsUser.BOF) then
else
Check = "E-Mail già in uso"
rsUser.Close
Exit Function
end if
if request.Form("txtNick") = "" then
Check = "Inserire il Nick"
Exit Function
end if
if request.Form("txtPwd") = "" then
Check = "Inserire la Password"
Exit Function
end if
if request.Form("txtMail") = "" then
Check = "Inserire la Mail"
Exit Function
end if
Check = ""
rsUser.Close
End Function
'---------------------------------------------
Sub DisplayOk()
%>
<table align="center" width="565" border="0">
<tr>
<td align="center">Registrazione Effettuata Correttamente</td>
</tr>
<tr>
<td align="center"><a href="index.asp">Clicca qui per Tornare alla Home</a></td>
</tr>
</table>
<%
End Sub
'---------------------------------------------
Sub InsertData(dcnDB)
Dim strSQL
Dim intLiv
Dim rsUser
Set rsUser = Server.CreateObject("ADODB.Recordset")
intLiv = 1
strSQL = "INSERT INTO User (Nick,Pwd,Mail,IDClan,Web) " _
& "VALUES (" _
& "'" & Replace(Trim(Request.Form("txtNick")),"'","''") & "'," _
& "'" & Replace(Trim(Request.Form("txtPwd")),"'","''") & "'," _
& "'" & Replace(Trim(Request.Form("txtMail")),"'","''") & "'," _
& "'" & Replace(Trim(Request.Form("cboClan")),"'","''") & "'," _
& "'" & Replace(Trim(Request.Form("txtWeb")),"'","''") & "'" _
& ")"
'rsUser.Open strSQL,dcnDB
dcnDB.Execute strSQL
'Response.Write(strSQL)
End Sub
'---------------------------------------------
Sub ShowPages(strStat, dcnDB,strErr)
%>
<td align="center" width="570" bgcolor="#ffffff">
<%
If strStat = "" then
BodyPages dcnDB, strErr
Else
DisplayOk
End if %>
</td>
<%
End Sub
'---------------------------------------------
Sub BodyPages(dcnDB, strErr)
Dim strSQL
Dim rsClan
strSQL = "SELECT * FROM Clan"
Set rsClan = dcnDB.Execute (strSQL)
%>
<table width="565" align="center" border="0">
<tr>
<td colspan="2" class="title">Registrati Qui!!
<%if strErr <> "" then Response.Write("<br>" & strErr) end if%>
</td>
</tr>
<form method="post" action="registrati.asp">
<input type="hidden" name="action" value="reg">
<tr>
<td>Nick:
</td>
<td><input type=text size=30 name="txtNick" value="<% if request("action") = "reg" then Response.Write request("txtNick")%>"></td>
</tr>
<tr>
<td>Password:
</td>
<td><input type=password size=30 id="Text1" name="txtPwd" value="<% if request("action") = "reg" then Response.Write request("txtPwd")%>"></td>
</tr>
<tr>
<td>Email:
</td>
<td><input type=text size=30 id="Text2" name="txtMail" value="<% if request("action") = "reg" then Response.Write request("txtMail")%>"></td>
</tr>
<tr>
<td>Indirizzo Web:
</td>
<td><input type=text size=30 id="Text3" name="txtWeb" value="<% if request("action") = "reg" then Response.Write request("txtWeb")%>"></td>
</tr>
<tr>
<td>Clan:
</td>
<td>
<select ID="Select1" NAME="cboClan">
<option selected value="0">Nessuno</option>
<%
do while not rsClan.eof
%>
<option value="<% = rsClan("IDClan") %>"><% = rsClan("Nome")%></option>
<%
rsClan.movenext
loop
%>
</select>
</td>
</tr>
<tr>
<td colspan="2" align="center"><input id="Submit1" type="submit" value="Registrati" name="cmdRegistrati"></td>
</tr>
</form>
</table>
<%
End Sub
'---------------------------------------------
%>