<% '------------------------------------------------------------------------------------ 'Copyright (C) 2007 AhrStudio ' 'This program is free software; you can redistribute it and/or 'modify it under the terms of the GNU General Public License 'as published by the Free Software Foundation; either version 2 'of the License, or (at your option) any later version. ' 'This program is distributed in the hope that it will be useful, 'but WITHOUT ANY WARRANTY; without even the implied warranty of 'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 'GNU General Public License for more details. ' 'A copy of the license may be found at www.fsf.org (Free Software Foundation) 'or inside the folder registrazione_e_gestione_utenti '------------------------------------------------------------------------------------ %> <% 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_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_citta = "" OR new_cap = "" 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("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 & " Registration" strMessage = "------------------------------------------" & vbCrLf & _ "Grazie per esserti registrato, " & strRecipientsName & "! Per completare la registrazione, inserisci un indirizzo email valido." & 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 & "
  • Impossibile spedire l'email: " & Err.Description & "
  • " 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 & "
  • Impossibile spedire l'email. Errore: " & objNewMail.Response & "
  • " 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 & "
  • Impossibile spedire l'email. Errore: " & Err.Description & "
  • " End if On Error Resume Next '## Ignora Errore Case "cdosys" Set objMessage = CreateObject("CDO.Message") objMessage.Sender = strFromEmail objMessage.TextBody = strMessage objMessage.To = strRecipientsEmail objMessage.Subject = strSubject objMessage.Send If Err <> 0 Then Err_Msg = Err_Msg & "
  • Impossibile spedire l'email. Errore: " & Err.Description & "
  • " 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 & "
  • Impossibile spedire l'email. Errore: " & Err.Description & "
  • " 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 & "
  • Impossibile spedire l'email. Errore: " & Err.Description & "
  • " 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 & "
  • Impossibile spedire l'email. Errore: " & Err.Description & "
  • " 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 & "
  • Impossibile spedire l'email. Errore: " & Err.Description & "
  • " 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 %> <%=pageTitle%> - Registrazione
    I campi contrassegnati con * sono obbligatori.
    <% If emptyValue = True AND new_nome = "" Then %> <% End If %> Nome <% If emptyValue = True AND new_nome = "" Then %> <% End If %> *
    <% If emptyValue = True AND new_cognome = "" Then %> <% End If %> Cognome <% If emptyValue = True AND new_cognome = "" Then %> <% End If %> *
    <% If emptyValue = True AND new_name = "" Then %> <% End If %> Username <% If emptyValue = True AND new_name = "" Then %> <% End If %> *
    <% If emptyValue = True AND new_pass = "" Then %> <% End If %> Password <% If emptyValue = True AND new_pass = "" Then %> <% End If %> *
    <% If emptyValue = True AND Request.Form("pw2") = "" Then %> <% End If %> Conferma Password <% If emptyValue = True AND Request.Form("pw2") = "" Then %> <% End If %> *
    <% If emptyValue = True AND new_email = "" Then %> <% End If %> Email <% If emptyValue = True AND new_email = "" Then %> <% End If %> *
    <% If emptyValue = True AND new_citta = "" Then %> <% End If %> Citta <% If emptyValue = True AND new_citta = "" Then %> <% End If %> *
    <% If emptyValue = True AND new_provincia = "" Then %> <% End If %> Provincia <% If emptyValue = True AND new_provincia = "" Then %> <% End If %> *
    <% if (not isNumeric (new_cap)) OR len(new_cap) =<4 then %> <% End if %> <% If emptyValue = True AND new_cap = "" Then %> <% End If %> C.A.P <% If emptyValue = True AND new_cap = "" Then %> <% End If %> <% if (not isNumeric (new_cap)) OR len(new_cap) =<4 then %> <% End if %> *
    Pagina Web " size="23" maxlength="30" style="border-style: solid; border-width: 1px">
    "> <% ip = Request.ServerVariables("REMOTE_ADDR") response.Write("IP: " &ip) %>

    <% Server.Execute("footer.asp")%>