<%@ CodePage = 65001 LCID = 1040 %> <% Response.expires = 0 Response.expiresabsolute = Now() - 1 Response.addHeader "pragma", "no-cache" Response.addHeader "cache-control", "private" Response.addHeader "cache-control", "no-cache" Response.addHeader "cache-control", "no-store" Response.CacheControl = "no-cache" %> <% ' Initialize common variables x_IDutente = Null: ox_IDutente = Null x_Nome = Null: ox_Nome = Null x_Cognome = Null: ox_Cognome = Null x_password = Null: ox_password = Null c_password = Null ' Initialize Password Confirmation Field x_login = Null: ox_login = Null x_livello = Null: ox_livello = Null x_email = Null: ox_email = Null Response.Buffer = True ' Get action sAction = Request.Form("a_register") If (sAction = "" Or IsNull(sAction)) Then sAction = "I" ' Display blank record Else ' Get fields from form x_IDutente = Request.Form("x_IDutente") x_Nome = Request.Form("x_Nome") x_Cognome = Request.Form("x_Cognome") x_password = Request.Form("x_password") x_login = Request.Form("x_login") x_livello = Request.Form("x_livello") x_email = Request.Form("x_email") End If ' Open connection to the database Set conn = Server.CreateObject("ADODB.Connection") conn.Open xDb_Conn_Str Select Case sAction Case "A": ' Add ' Check for Duplicate User ID sUserSql = "SELECT * FROM [utenti]" sUserSql = sUserSql & " WHERE [login] = '" & AdjustSql(x_login) & "'" Set rs = conn.Execute(sUserSql) If Not rs.Eof Then bUserExists = True Session("ewmsg") = "Utente già inserito!" End If rs.Close Set rs = Nothing If Not bUserExists Then If AddData() Then ' Add New Record ' Load Registrant Email sEmail = x_email ' Load Email Content If sEmail <> "" Then sEmailSubject = "" sEmailFrom = "" sEmailTo = "" sEmailCc = "" sEmailBcc = "" sEmailFormat = "" sEmailContent = "" Call LoadEmail("register.txt") sEmailFrom = Replace(sEmailFrom, "", "protty@protty.it") ' Replace Sender sEmailTo = Replace(sEmailTo, "", sEmail) ' Replace Receiver sEmailContent = Replace(sEmailContent, "", x_Nome) sEmailContent = Replace(sEmailContent, "", x_Cognome) sEmailContent = Replace(sEmailContent, "", x_password) sEmailContent = Replace(sEmailContent, "", x_login) sEmailContent = Replace(sEmailContent, "", x_email) ' Send Email Call Send_Email(sEmailFrom, sEmailTo, sEmailCc, sEmailBcc, sEmailSubject, sEmailContent, sEmailFormat) End If Session("ewmsg") = "Registrazione effettuata" conn.Close Set conn = Nothing Response.Redirect "login.asp" End If End If End Select %>

Pagina di Registrazione

Torna al login

<% If Session("ewmsg") <> "" Then %>

<%= Session("ewmsg") %>

<% Session("ewmsg") = "" ' Clear message End If %>

Nome  ">  
Cognome  ">  
password  ">  
Conferma password  ">  
nome per login  ">  
e-mail  ">  

<% '------------------------------------------------------------------------------- ' Function AddData ' - Add Data ' - Variables used: field variables Function AddData() Dim sSql, rs, sWhere, sGroupBy, sHaving, sOrderBy Dim bCheckKey, sSqlChk, sWhereChk sSql = "SELECT * FROM [utenti]" sWhere = "" sGroupBy = "" sHaving = "" sOrderBy = "" ' Check for duplicate key bCheckKey = True sWhereChk = sWhere If x_IDutente = "" Or IsNull(x_IDutente) Then bCheckKey = False Else If sWhereChk <> "" Then sWhereChk = sWhereChk & " AND " sWhereChk = sWhereChk & "([IDutente] = " & AdjustSql(x_IDutente) & ")" End If If bCheckKey Then sSqlChk = sSql & " WHERE " & sWhereChk Set rsChk = conn.Execute(sSqlChk) If Not rsChk.Eof Then Session("ewmsg") = "Chiave Primaria Duplicata --" rsChk.Close Set rsChk = Nothing AddData = False Exit Function End If rsChk.Close Set rsChk = Nothing End If ' Add New Record If sWhere <> "" Then sWhere = sWhere & " AND " sWhere = sWhere & "(0 = 1)" sSql = sSql & " WHERE " & sWhere If sGroupBy <> "" Then sSql = sSql & " GROUP BY " & sGroupBy End If If sHaving <> "" Then sSql = sSql & " HAVING " & sHaving End If If sOrderBy <> "" Then sSql = sSql & " ORDER BY " & sOrderBy End If Set rs = Server.CreateObject("ADODB.Recordset") rs.CursorLocation = 3 rs.Open sSql, conn, 1, 2 rs.AddNew ' Field Nome sTmp = Trim(x_Nome) If Trim(sTmp) = "" Then sTmp = Null rs("Nome") = sTmp ' Field Cognome sTmp = Trim(x_Cognome) If Trim(sTmp) = "" Then sTmp = Null rs("Cognome") = sTmp ' Field password sTmp = Trim(x_password) If Trim(sTmp) = "" Then sTmp = Null rs("password") = sTmp ' Field login sTmp = Trim(x_login) If Trim(sTmp) = "" Then sTmp = Null rs("login") = sTmp ' Field livello rs("livello") = 1 ' Set Default User Level ' Field email sTmp = Trim(x_email) If Trim(sTmp) = "" Then sTmp = Null rs("email") = sTmp If Session("lapinsitter_status_UserID") <> -1 And Session("lapinsitter_status_UserID") <> "" Then ' Non system admin rs("IDutente") = Session("lapinsitter_status_UserID") End If rs.Update rs.Close Set rs = Nothing AddData = True End Function %>