Modificare il file:
\registrazione\registrazione.asp
<!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" NAME="CDO for Windows 2000 Type Library" --> <!--METADATA TYPE="typelib" UUID="00000205-0000-0010-8000-00AA006D2EA4" NAME="ADODB Type Library" --> <!--#include file="inc_common.asp" --> <% Server.Execute("header.asp") %> <% If Request.QueryString("step") = 2 Then Dim str_db_username 'username Dim str_wanted_username 'richiesto username Dim str_new_usercode 'generare user code Dim int_random_number 'numero random Dim int_random_number_max 'valore massimo del numero randomico Dim int_random_number_min 'valore minimo del numero randomico Dim str_password 'password Dim rs_new_user 'Recordsheet per il nuovo utente Dim rs_check_username 'Recordsheet per controllare username 'Richiamo i valori str_wanted_username = Request.form("username") str_password = Request.form("pw1") 'Creo una nuova stringa SQL strSQL = "SELECT * FROM tbl_authors" 'Creo un nuovo RecordSet set rs_check_username=Server.CreateObject("ADODB.Recordset") 'Apro il recordset e eseguo SQL rs_check_username.Open strSQL,adoCon 'Eseguo un ciclo fino alla fine Do While NOT rs_check_username.EOF 'Set variable to hold a database username value str_db_username = rs_check_username("name") 'See l'username è già inserito nel database response.Redirect("errore.asp") If str_db_username = str_wanted_username Then Response.Redirect("errore.asp") 'passo al record successivo rs_check_username.MoveNext 'Loop Loop rs_check_username.Close Set rs_check_username = Nothing new_name = Request.form("username") new_email = Request.form("email") new_pass = Request.form("pw1") new_nome = Request.form("nome") new_cognome = Request.form("cognome") new_Tel = Request.form("Tel") 'new_citta = Request.form("citta") 'new_provincia = Request.form("provincia") 'new_cap = Request.form("cap") new_authority = "user" new_date = Now() new_code = str_new_usercode 'new_pagina_web = Request.form("pagina_web") If new_name = "" OR new_email = "" OR new_pass = "" OR new_nome = "" OR new_cognome = "" OR new_Tel = "" Then emptyValue = True Else If Request.Form("pw1") <> Request.Form("pw2") Then badPass = True Else badPass = False End If emptyValue = False End If If emptyValue = False AND badPass = False Then 'Creo un numero random Randomize int_random_number_Min = 1 int_random_number_Max = 999999999 int_random_number = Int(((int_random_number_Max-int_random_number_Min+1) * Rnd) + int_random_number_Min) 'converto il numero in una stringa int_random_number = Cstr(int_random_number) 'concateno username e il numero random str_new_usercode = str_wanted_username + int_random_number 'Creo una nuova stringa SQL strsql="SELECT * FROM tbl_authors" 'Creo un nuovo recordset set rs_new_user = Server.CreateObject("ADODB.Recordset") rs_new_user.CursorType = 2 rs_new_user.LockType = 3 'apro recordsheet e eseguo la stringa SQL rs_new_user.open strsql,adocon 'setto recordsheet e aggiungo un nuovo record rs_new_user.AddNew 'Enter a new record into the database rs_new_user.Fields("name") = new_name rs_new_user.Fields("email") = new_email rs_new_user.Fields("pass") = new_pass rs_new_user.Fields("nome") = new_nome rs_new_user.Fields("cognome") = new_cognome rs_new_user.Fields("Tel") = new_Tel 'rs_new_user.Fields("citta") = new_citta 'rs_new_user.Fields("provincia") = new_provincia 'rs_new_user.Fields("cap") = new_cap rs_new_user.Fields("authority") = "user" rs_new_user.Fields("dataregistrazione") = Now rs_new_user.Fields("code") = str_new_usercode 'rs_new_user.Fields("pagina_web") = Request.form("pagina_web") If conf_email = "False" Then rs_new_user.Fields("stato") = "Active" End If 'aggiorno il recordset rs_new_user.Update rs_new_user.Close set rs_new_user = Nothing curSubFolders = "" tempArray = Split(Replace(Request.ServerVariables("URL"), "\", "/"), "/") Dim i i = 0 For each chunk in tempArray i = i + 1 Next For j = 0 to (i-2) curSubFolders = curSubFolders & tempArray(j) & "/" Next If conf_email = "True" AND tipoMail <> "None" Then strFromName = pageTitle & " Webmaster" strFromEmail = adminEmail strRecipientsEmail = new_email strRecipientsName = new_name strSubject = pageTitle & " Registrazione" strMessage = "------------------------------------------" & vbCrLf & _ "Grazie per esserti registrato, " & strRecipientsName & "! " & vbCrLf & _ "Per completare la registrazione, clikka sul seguente indirizzo:" & vbCrLf & _ " " & homePage & curSubFolders & "attivo.asp?userCode=" & str_new_usercode & vbCrLf & vbCrLf & _ "Grazie," & vbCrLf & pageTitle & " Webmaster" Select Case LCase(tipoMail) Case "aspemail" Set objNewMail = Server.CreateObject("Persits.MailSender") objNewMail.Host = mailServer objNewMail.FromName = strFromName objNewMail.AddReplyTo strFromEmail objNewMail.From = strFromEmail objNewMail.AddAddress strRecipientsEmail, strRecipientsName objNewMail.Subject = strSubject objNewMail.Body = strMessage On Error Resume Next '## Ignora Errore objNewMail.Send If Err <> 0 Then Err_Msg = Err_Msg & "<li>Impossibile spedire l'email: " & Err.Description & "</li>" End if Case "aspmail" Set objNewMail = Server.CreateObject("SMTPsvg.Mailer") objNewMail.FromName = strFromName objNewMail.FromAddress = strFromEmail 'objNewMail.AddReplyTo = strFromEmail objNewMail.RemoteHost = mailServer objNewMail.AddRecipient strRecipientsName, strRecipientsEmail objNewMail.Subject = strSubject objNewMail.BodyText = strMessage On Error Resume Next '## Ignora Errore SendOk = objNewMail.SendMail If not(SendOk) <> 0 Then Err_Msg = Err_Msg & "<li>Impossibile spedire l'email. Errore: " & objNewMail.Response & "</li>" End if Case "cdonts" Set objNewMail = Server.CreateObject ("CDONTS.NewMail") objNewMail.BodyFormat = 1 objNewMail.MailFormat = 0 On Error Resume Next '## Ignora Errore objNewMail.Send strFromEmail, strRecipientsEmail, strSubject, strMessage If Err <> 0 Then Err_Msg = Err_Msg & "<li>Impossibile spedire l'email. Errore: " & Err.Description & "</li>" End if On Error Resume Next '## Ignora Errore Case "cdosys" 'Set objMessage = CreateObject("CDO.Message") 'objMessage.Sender = strFromEmail 'objMessage.TextBody = strMessage ' INVIA mail al destinatario 'objMessage.To = strRecipientsEmail ' ERA --- strFromEmail 'objMessage.Subject = strSubject 'objMessage.Send ' Modifica per server Aruba 26/10/2015 Dim iMsg Dim iConf Dim Flds set iMsg = CreateObject("CDO.Message") set iConf = CreateObject("CDO.Configuration") Set Flds = iConf.Fields With Flds .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.martinucci-regali.com" .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 '.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = CdoSendUsingPort .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .Update End With With iMsg Set .Configuration = iConf .Sender = strFromEmail .TextBody = strMessage .To = strRecipientsEmail ' ********************************************** .Subject = strSubject '*********************************************** .From = strFromEmail 'strRecipientsEmail .Send End With ' Clean up variables. Set iMsg = Nothing Set iConf = Nothing Set Flds = Nothing If Err <> 0 Then Err_Msg = Err_Msg & "<li>Impossibile spedire l'email. Errore: " & Err.Description & "</li>" End if On Error Resume Next '## Ignora Errore Case "chilicdonts" Set objNewMail = Server.CreateObject ("CDONTS.NewMail") On Error Resume Next '## Ignora Errore objNewMail.Host = mailServer objNewMail.To = strRecipientsEmail objNewMail.From = strFromEmail objNewMail.Subject = strSubject objNewMail.Body = strMessage objNewMail.Send If Err <> 0 Then Err_Msg = Err_Msg & "<li>Impossibile spedire l'email. Errore: " & Err.Description & "</li>" End if On Error Resume Next '## Ignora Errore Case "jmail" Set objNewMail = Server.CreateObject("Jmail.smtpmail") objNewMail.ServerAddress = mailServer objNewMail.AddRecipient strRecipientsEmail objNewMail.Sender = strFromEmail objNewMail.Subject = strSubject objNewMail.Body = strMessage objNewMail.Priority = 3 On Error Resume Next '## Ignora Errore objNewMail.Execute If Err <> 0 Then Err_Msg = Err_Msg & "<li>Impossibile spedire l'email. Errore: " & Err.Description & "</li>" End if Case "jmail4" Set objNewMail = Server.CreateObject("Jmail.Message") 'objNewMail.MailServerUserName = "mioUserName" 'objNewMail.MailServerPassword = "MiaPassword" objNewMail.From = strFromEmail objNewMail.FromName = strFromName objNewMail.AddRecipient strRecipientsEmail, strRecipientsName objNewMail.Subject = strSubject objNewMail.Body = strMessage On Error Resume Next '## Ignora Errore objNewMail.Send(mailServer) If Err <> 0 Then Err_Msg = Err_Msg & "<li>Impossibile spedire l'email. Errore: " & Err.Description & "</li>" End if Case "smtp" Set objNewMail = Server.CreateObject("SmtpMail.SmtpMail.1") objNewMail.MailServer = mailServer objNewMail.Recipients = strRecipientsEmail objNewMail.Sender = strFromEmail objNewMail.Subject = strSubject objNewMail.Message = strMessage On Error Resume Next '## Ignora Errore objNewMail.SendMail2 If Err <> 0 Then Err_Msg = Err_Msg & "<li>Impossibile spedire l'email. Errore: " & Err.Description & "</li>" End if End Select Set objNewMail = Nothing On Error Goto 0 Response.Redirect("benvenuto.asp") Else Session("tmpUN") = new_name Response.Redirect("login.asp?disp=login") End If End If End If %> <!doctype html public "-//w3c//dtd html 3.2//en"><html> <head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <SCRIPT LANGUAGE="JavaScript"> <!-- function DoSubmit(obj) { var nome = obj.nome.value; var cognome = obj.cognome.value; var username = obj.username.value; var password = obj.pw1.value; var confirmation = obj.pw2.value; var email = obj.email.value; var Tel = obj.Tel.value; var strMailFilter = /^.+@.+\..{2,3}$/; var strIllegalChars = /[\(\)\<\>\,\;\:\\\/\*\-\+\=\"\[\]]/; var submitform = true; var error = '************************* REGISTRAZIONE *************************\n\n'; error += ' Attenzione : \n\n'; if (nome.length < 3 ) { error += ' + Nome è un campo richiesto \n'; submitform = false; } if (nome.length > 20 && isNaN(nome) ) { error += ' + Nome può essere massimo 20 caratteri \n'; submitform = false; } if (nome.length > 1 && nome.match(strIllegalChars) ) { error += ' + Nome contiene caratteri non consentiti \n'; submitform = false; } if (cognome.length < 1) { error += ' + Cognome è un campo obbligatorio \n'; submitform = false; } if (cognome.length > 20 ) { error += ' + Cognome può essere massimo 20 caratteri \n'; submitform = false; } if (cognome.length > 1 && cognome.match(strIllegalChars)) { error += ' + Cognome contiene caratteri non consentiti \n'; submitform = false; } if (username.length < 1) { error += ' + Username è una campo richiesto \n'; submitform = false; } if (username.length > 20) { error += ' + Username può essere massimo 20 caratteri \n'; submitform = false; } if (username.length > 1 && username.match(strIllegalChars)) { error += ' + Nome contiene caratteri non consentiti \n'; submitform = false; } if (password.length < 5) { error += ' + Password deve essere minimo 5 caratteri \n'; submitform = false; } if (password.length > 20) { error += ' + Password può essere massimo 20 caratteri \n'; submitform = false; } if (confirmation.length < 1) { error += ' + Conferma password è un campo obbligatorio \n'; submitform = false; } if (password != confirmation) { error += ' + Password non è uguale \n'; submitform = false; } if (email.length < 1) { error += ' + Email è un campo obbligatorio \n'; submitform = false; } if (email.length > 50) { error += ' + Email è massimo 50 caratteri \n'; submitform = false; } if (email.length > 1 && email.match(strIllegalChars)) { error += ' + Email contiene caratteri non consentiti \n'; submitform = false; } if (email.length > 1 && !email.match(strIllegalChars) && !(strMailFilter.test(email))) { error += ' + Email non è valida \n'; submitform = false; } if (Tel.length < 3 ) { error += ' + Telefono è un campo richiesto \n'; submitform = false; } if (Tel.length > 50 ) { error += ' + Il campo telefono può essere massimo 50 caratteri \n'; submitform = false; } if (Tel.length > 1 && Tel.match(strIllegalChars)) { error += ' + Telefono contiene caratteri non consentiti \n'; submitform = false; } if (submitform) { obj.submit(); } else { error += '\n************************* REGISTRAZIONE *************************\n\n'; alert (error); return false; } } --> </script> <LINK href="css/file.css" type=text/css rel=stylesheet> </head> <title><%=pageTitle%> - Registrazione</title> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" height="14"> <tr> <td width="100%" height="14"> <img border="0" src="images/registrazione.gif"></td> </tr> </table> <br> <form name="registrationForm" method="post" action="registrazione.asp?step=2" onReset="return confirm('Sei sicuro di voler cancellare tutti i dati nel form?')"> <div align="center"> <center> <table width="62%" border="0" align="left" cellpadding="0" cellspacing="0" bordercolor="black" style="border-collapse: collapse"> <tr> <td colspan="2">I campi contrassegnati con * sono obbligatori.</td> </tr> <tr> <td height="8" colspan="2"></td> </tr> <tr> <td width="18%"><b> <% If emptyValue = True AND new_nome = "" Then %> <font color="#000000"> <% End If %> Nome <% If emptyValue = True AND new_nome = "" Then %> </font> <% End If %> *</b></td> <td width="82%" align="left"> <input name="nome" value="<%=new_nome%>" size="30" maxlength="20"></td> </tr> <tr> <td></td> <td width="82%" align="left"></td> </tr> <tr> <td height="8"><img border="0" src="images/trans.gif" width="250" height="1"></td> <td width="82%" height="8" align="left"></td> </tr> <tr> <td><b> <% If emptyValue = True AND new_cognome = "" Then %> <font color="#000000"> <% End If %> Cognome <% If emptyValue = True AND new_cognome = "" Then %> </font> <% End If %> *</b></td> <td width="82%" align="left"> <input name="cognome" value="<%=new_cognome%>" size="30" maxlength="20"></td> </tr> <tr> <td></td> <td width="82%" align="left"></td> </tr> <tr> <td height="8"><img border="0" src="images/trans.gif" width="250" height="1"></td> <td width="82%" height="8" align="left"></td> </tr> <tr> <td><b> <% If emptyValue = True AND new_name = "" Then %> <font color="#000000"> <% End If %> Username <% If emptyValue = True AND new_name = "" Then %> </font> <% End If %> *</b></td> <td width="82%" align="left"> <input name="username" type="text" value="<%=new_name%>" size="30" maxlength="20"></td> </tr> <tr> <td height="8"></td> <td width="82%" height="8" align="left"></td> </tr> <tr> <td></td> <td width="82%" align="left"></td> </tr> <tr> <td height="8"><b> <% If emptyValue = True AND new_pass = "" Then %> <font color="#000000"> <% End If %> Password <% If emptyValue = True AND new_pass = "" Then %> </font> <% End If %> *</b></td> <td width="82%" height="8" align="left"> <input name="pw1" type="password" value="" size="30" maxlength="20"></td> </tr> <tr> <td></td> <td width="82%" align="left"></td> </tr> <tr> <td height="10"></td> <td width="82%" height="10" align="left"></td> </tr> <tr> <td></td> <td width="82%" align="left"></td> </tr> <tr> <td height="8"><b> <% If emptyValue = True AND Request.Form("pw2") = "" Then %> <font color="#000000"> <% End If %> Conferma Password <% If emptyValue = True AND Request.Form("pw2") = "" Then %> </font> <% End If %> *</b></td> <td width="82%" height="8" align="left"> <input name="pw2" type="password" value="" size=30" maxlength="20"></td> </tr> <tr> <td></td> <td width="82%" align="left"></td> </tr> <tr> <td height="8"></td> <td width="82%" height="8" align="left"></td> </tr> <tr> <td><b> <% If emptyValue = True AND new_email = "" Then %> <font color="#000000"> <% End If %> Email <% If emptyValue = True AND new_email = "" Then %> </font> <% End If %> *</b></td> <td width="82%" align="left"> <input name="email" type="text" value="<%=new_email%>" size="50" maxlength="50"></td> </tr> <tr> <td height="8"></td> <td width="82%" height="8" align="left"></td> </tr> <tr> <td><b> <% If emptyValue = True AND new_Tel = "" Then %> <% ' If emptyValue = True AND new_citta = "" Then %> <font color="#000000"> <% End If %> Telefono/Cellulare <% If emptyValue = True AND new_Tel = "" Then %> </font> <% End If %> *</b></td> <td width="82%" align="left"> <input name="Tel" type="text" value="<%=new_Tel%>" size="30" maxlength="50"></td> </tr> <tr> <td></td> <td width="82%" align="left"></td> </tr> <tr> <td></td> <td width="82%" align="left"></td> </tr> <tr> <td height="8"><br> <input type="hidden" name="ip" value="<%=Request.ServerVariables("REMOTE_ADDR")%>"> <% ip = Request.ServerVariables("REMOTE_ADDR") response.Write("IP: " &ip) %></td> <td width="82%" height="8" align="left"></td> </tr> <tr> <td colspan="2"> <p> </p> <p> <input type="button" value="Registrati" onClick="DoSubmit(document.registrationForm)"> <input type="reset" value="Cancella" > </p></td> </tr> </table> </center> </div> </form> <% Server.Execute("footer.asp")%>
[
Íàçàä
]