001: <!--#include file="config.asp"-->
002: <%
003: if Request.TotalBytes>0 then
004: dim strLogin
005: strLogin = request.form("login")
006: strLogin = trim(strLogin)
007: dim strCode
008: strCode = request.form("codice")
009: strCode = trim(strCode)
010: dim strMail
011: strMail = request.form("mail")
012: strMail = trim(strMail)
013: dim intValido
014: intValido = 0
015:
016: if(strMail<>"")AND(strCode<>"")AND(strLogin<>"")then
017:
018: Dim Conn
019: Dim Comm
020: Dim Rs
021:
022: 'Verifico che non vi sia gi utente
023:
024: Set conn = Server.CreateObject("ADODB.Connection")
025: Set comm = Server.CreateObject("ADODB.Command")
026: Set Rs = Server.CreateObject("ADODB.Recordset")
027:
028: conn.CommandTimeout = 40
029: conn.CursorLocation = 1
030: conn.ConnectionString = dbConnessione
031: conn.Open
032:
033: comm.ActiveConnection = conn
034: comm.CommandType = 1
035:
036: comm.CommandText = "select id_user from utenti where login='"&strLogin&"'"
037:
038: Rs.Open comm,,1,1
039:
040: if not(rs.eof) then
041: intValido = 1
042: end if
043:
044: rs.close
045: conn.close
046:
047: set rs = nothing
048: set comm = nothing
049: set conn = nothing
050:
051: if (intValido = 0 ) then
052:
053: 'Inserisco l'utente
054: Set Conn = Server.CreateObject("ADODB.Connection")
055: Set Rs = Server.CreateObject("ADODB.Command")
056:
057: Conn.ConnectionString = dbConnessione
058: Conn.Open
059:
060: Rs.ActiveConnection = Conn
061: Rs.CommandType = 1
062: Rs.CommandText = "insert into utenti(login, codice, mail) values('"&strLogin&"','"&strCode&"','"&strMail&"')"
063: Rs.Execute
064:
065: Conn.Close
066:
067: set Conn = nothing
068: set Rs = nothing
069:
070: 'Prelevo id_user appena registrato
071:
072: Set conn = Server.CreateObject("ADODB.Connection")
073: Set comm = Server.CreateObject("ADODB.Command")
074: Set Rs = Server.CreateObject("ADODB.Recordset")
075:
076: conn.CommandTimeout = 40
077: conn.CursorLocation = 1
078: conn.ConnectionString = dbConnessione
079: conn.Open
080:
081: comm.ActiveConnection = conn
082: comm.CommandType = 1
083:
084: comm.CommandText = "select id_user from utenti where login='"&strLogin&"'"
085:
086: Rs.Open comm,,1,1
087:
088: response.cookies("messaggistica")("iduser") = rs("id_user")
089:
090: rs.close
091: conn.close
092:
093: set rs = nothing
094: set comm = nothing
095: set conn = nothing
096:
097: 'Invio una mail con i dati appena immessi
098: on error resume next
099: Set mail = Server.CreateObject("CDONTS.NewMail")
100: strFrom = "Webmaster of innovatel.it<webmaster@innovatel.it>"
101: mail.From = strFrom
102: mail.to = strMail
103: strBody ="<br>Dati riassuntivi registrazione messaggistica<br><br>"
104: strBody = strBody & "_ username: <b>" & strLogin &"</b><br>"
105: strBody = strBody & "_ password: <b>" & strCode &"</b><br>"
106: strBody = strBody & "_ Indirizzo email: <b>" & strMail &"</b><br><br>"
107: strBody = strBody & "Registrazione effettuata il: " & now() &"<br>"
108: strBody = strBody & "Indirizzo I.P. : "& request.ServerVariables("REMOTE_ADDR") &"<br><br>"
109: strBody = strBody & " *** Lo staff di innovatel.it *** "
110: mail.Body = strBody
111: mail.Subject = "Registrazione Messaggistica"
112: mail.mailFormat=0
113: mail.bodyFormat=0
114: mail.Send
115: set mail = nothing
116:
117: 'Reindirizzamento utente alla pagina dei messaggi
118:
119: response.cookies("messaggistica")("login") = strLogin
120:
121: response.redirect "messaggi.asp"
122:
123: end if
124:
125: else
126: intValido = 2
127: end if
128: end if
129: %>
130: <html>
131: <head>
132: <title>Registrazione Nuovo Utente</title>
133: <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
134: <link href="stile.css" rel="stylesheet" type="text/css">
135: </head>
136: <body>
137: <form name="form1" method="post" action="registra.asp">
138: <table width="94%" height="26%" border="0" align="center" cellpadding="0" cellspacing="2">
139: <tr bgcolor="#66CCFF">
140: <td height="16%" colspan="5">
141: <div align="center"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Pagina
142: di registrazione nuovo utente</font></strong></div></td>
143: </tr>
144: <tr>
145: <td colspan="5">
146: <%
147: select case intValido
148: case 0
149: response.write "&nbsp;"
150: case 1
151: response.write "Nome utente gi in uso. Sceglierne nuovo."
152: case 2
153: response.write "Verificare i dati immessi."
154: end select
155: %>
156: </td>
157: </tr>
158: <tr>
159: <td width="4%" height="19%">&nbsp;</td>
160: <td><div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Nome
161: Utente</font></div></td>
162: <td><div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Codice
163: d'accesso</font></div></td>
164: <td><div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Indirizzo
165: E-mail</font></div></td>
166: <td width="6%">&nbsp;</td>
167: </tr>
168: <tr>
169: <td width="4%" height="22%">&nbsp;</td>
170: <td><div align="center">
171: <input type="text" name="login">
172: </div></td>
173: <td><div align="center">
174: <input type="password" name="codice">
175: </div></td>
176: <td><div align="center">
177: <input type="text" name="mail">
178: </div></td>
179: <td width="6%">&nbsp;</td>
180: </tr>
181: <tr>
182: <td height="24%">&nbsp;</td>
183: <td>&nbsp;</td>
184: <td>&nbsp;</td>
185: <td><div align="center">
186: <input type="submit" name="Submit" value="Registra Utente">
187: </div></td>
188: <td>&nbsp;</td>
189: </tr>
190: </table>
191: </form>
192: </body>
193: </html>