% '------------------------------------------------------------------------------------ 'Copyright (C) 2004 Demetrio G. Milea ' '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 & _ "Iscrizione conclusa con successo, " & strRecipientsName & "! Per completare la registrazione," & vbCrLf & _ "clicca sul seguente indirizzo:" & vbCrLf & _ " " & homePage & curSubFolders & "attivo.asp?userCode=" & str_new_usercode & vbCrLf & vbCrLf & _ "Nel caso occorrano errori nel Link ritenetevi automaticamente iscritti, il sistema monitora regolarmente i vostri processi e automaticamente vi attiva nel caso di semplici errori di visualizzazione del link. 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 & "
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||