Modificare il file:
\registrazione\aggiorna_profilo.asp
<!--#include file="inc_common.asp" --> <!--#include file="inc_viewuser.asp" --> <!--#include file="inc_checklogin.asp" --> <% Server.Execute("header.asp") %> <% If str_users_name = "" Then Response.Redirect("noentry.asp") End If %> <% Dim isCodeValid Dim str_stato, str_name 'Creo una nuova stringa SQL If Request.QueryString("userCode") <> "" Then validateSQL = "SELECT * FROM tbl_Authors WHERE code = '" & Request.QueryString("userCode") & "'" Else validateSQL = "SELECT * FROM tbl_Authors WHERE code = '" & str_code & "'" End If 'Creo un nuovo recordsheet Set rs_validate = Server.CreateObject ("ADODB.RecordSet") 'Apro il record sheet e eseguo SQL rs_validate.open validateSQL,adoCon 'Se il codice non è valido setta isCodeValid = false If rs_validate.EOF _ Or rs_validate.BOF Then isCodeValid = false Else isCodeValid = true str_stato = rs_validate("stato") str_name = rs_validate("name") End If 'Chiudo rs_validate set rs_validate = Nothing %> <% If Request.QueryString("step") = "2" AND isCodeValid = true AND str_users_stato = "Active" Then 'Setto tutte le variabili da inserire nel database Dim new_nome, new_cognome, new_password, new_email, new_tel, new_authority, new_stato new_nome = Request.Form("nome") new_cognome = Request.Form("cognome") new_password = Request.Form("pw1") new_email = Request.Form("email") new_tel = Request.Form("Tel") 'new_citta = Request.Form("citta") 'new_provincia = Request.Form("provincia") 'new_cap = Request.Form("cap") 'new_pagina_web = Request.Form("pagina_web") new_utentesospeso = Request.Form("utentesospesoInput") If new_nome = "" OR new_cognome = "" OR new_password = "" OR new_email = "" OR new_tel = "" OR (Request.Form("stato") = "Disabled" AND Request.Form("utentesospesoInput") = "") Then emptyValue = True ElseIf Request.Form("pw1") <> Request.Form("pw2") Then badPass = True Else emptyValue = False If Request.Form("newAuthority") <> "" Then new_authority = Request.Form("newAuthority") Else new_authority = Request.Form("authority") End If If Request.Form("userStato") <> "" Then new_stato = Request.Form("userStato") Else new_stato = rs_viewuser("stato") End If If Request.QueryString("userCode") <> "" AND Request.Form("userStato") <> "" Then tempID = Request.QueryString("userCode") Else tempID = str_code End If Set RS = Server.CreateObject ("ADODB.RecordSet") Sql = "SELECT * FROM tbl_authors WHERE code='" & tempID & "'" RS.Open Sql,adoCon,2,3 RS("nome") = new_nome RS("cognome") = new_cognome RS("pass") = new_password RS("email") = new_email RS("Tel") = new_Tel ' ################################ ' TOLTO CAMPI ' ################################# 'RS("citta") = new_citta 'RS("provincia") = new_provincia 'RS("cap") = new_cap 'RS("pagina_web") = new_pagina_web RS("authority") = new_authority RS("stato") = new_stato RS("utentesospeso") = new_utentesospeso RS.Update RS.Close If Request.QueryString("userCode") <> "" AND str_users_authority <> "user" AND Request.QueryString("userCode") <> Request.Form("userCode") Then Response.Redirect("lista_utenti.asp") Else Response.Redirect("visualizza_profilo.asp") End If End If End If %> <title><%=pageTitle%> - Aggiorna Profilo</title> <% If isCodeValid = false Then %> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <p align="center">User Code non valido. <a href="javascript:history.go(-1)">Riprova</a></p> <% ElseIf str_stato = "Attesa" AND str_users_authority = "user" Then %> <p align="center">Il tuo account è in Attesa di conferma. Per attivare l'account controllare l'email e clikkare sul link. In caso di problemi contatta il <a href="mailto:<%=adminEmail%>">Webmaster</a>.</p> <% ElseIf str_stato = "Disabled" AND str_users_authority = "user" Then %> <div align="center"> <center> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1"> <tr> <td colspan="2"> <p align="center">Il tuo account è stato sospeso. Se pensi che possa essere riattivato, contatta il <a href="mailto:<%=adminEmail%>">Webmaster</a>.</p> </td> </tr> <tr> <td height="8" colspan="2"></td> </tr> <tr> <td colspan="2"> <p align="center">Il tuo account è stato sospeso:</p> </td> </tr> <tr> <td height="8" colspan="2"></td> </tr> <tr> <td width="25%" height="1"></td> <td width="75%" height="1"> <ul> <% curReason = Split(str_users_utentesospeso, ";") i = 0 For Each reason In curReason %> <li><b><%=curReason(i)%></b></li> <% i = i + 1 Next %> </li> </ul> </td> </tr> </table> </center> </div> <% ElseIf (rs_viewuser("authority") = "admin" AND str_users_authority <> "admin") or (rs_viewuser("authority") = "mod" AND str_users_authority = "user") Then %> <p align="center"><b><%=str_users_name%></b>! Stai tentando di modificare un account con privilegi di amministratore. Tu puoi <a href="aggiorna_profilo.asp">aggiornare solo il tuo profilo</a></p> <% Else %> <script language="JavaScript"> function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function checkutentesospeso(obj) { if(obj.selectedIndex==2) { MM_findObj('utentesospesoText', document).innerHTML = "<b>Ragione per la sospensione dell'account*</b>"; MM_findObj('utentesospesoInputDiv', document).innerHTML = "<textarea name='utentesospesoInput' rows='3' cols='25'>" + document.updateForm.utentesospesoHidden.value + "</textarea>"; } else { if(document.updateForm.utentesospesoInput != null) { document.updateForm.utentesospesoHidden.value = document.updateForm.utentesospesoInput.value; } MM_findObj('utentesospesoText', document).innerHTML = ""; MM_findObj('utentesospesoInputDiv', document).innerHTML = ""; } } </script> <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/modifica_prifilo.gif"></td> </tr> </table> <br> <form action="aggiorna_profilo.asp?step=2<% If Request.QueryString("userCode") <> "" Then Response.Write("&userCode=" & Request.QueryString("userCode")) End If %>" name="updateForm" method="post"> <input type="hidden" value="<%=str_code%>" name="userCode"> <input type="hidden" name="authority" value="<%=rs_viewuser("authority")%>"> <input type="hidden" name="utentesospesoHidden" value="<%If rs_viewuser("utentesospeso") <> "" Then Response.Write(Replace(rs_viewuser("utentesospeso"), "''", "'")) End If%>"> <div align="left"> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="black" width="100%"> <% If emptyValue = True Then %> <tr> <td colspan="2"> <div align="center"> Alcuni campi richiesti, sono vuoti. </div></td> </tr> <tr> <td height="8" colspan="2"></td> </tr> <% If new_stato = "Disabled" AND new_utentesospeso = "" Then %> <tr> <td colspan="2"> <div align="center"> Specifica una ragione per sospendere un account.</div></td> </tr> <tr> <td height="8" colspan="2"></td> </tr> <% End If %> <% End If %> <% If badPass = True Then %> <tr> <td colspan="2"> <div align="center"> <font color="#33cc33"><b>Le password devono essere uguali</b></font></div></td> </tr> <tr> <td height="8" colspan="2"></td> </tr> <% End If %> <tr> <td height="8" colspan="2"></td> </tr> <tr> <td colspan="2">I campi con * sono obbligatori.</td> </tr> <tr> <td height="8" colspan="2"></td> </tr> <tr> <td height="8" colspan="2"><center> <p>Ciao, <b><%=rs_viewuser("name")%></b></p> </center></td> </tr> <tr> <td height="8" width="355"> <img border="0" src="images/trans.gif" width="250" height="1"></td> <td height="8" width="622"></td> </tr> <tr> <td height="8" width="355"><b> <%If emptyValue = True AND new_nome = "" Then Response.Write("<font color=""" & errorColor & """>Nome</font>") Else Response.Write("Nome") End If%> *</b></td> <td height="8" width="622"> <input name="nome" size="30" maxlength="20" value="<%If emptyValue = True Then Response.Write(Request.Form("Nome")) Else Response.Write(rs_viewuser("nome")) End If%>"></td> </tr> <tr> <td width="355"></td> <td width="622"></td> </tr> <tr> <td height="8" width="355"></td> <td height="8" width="622"></td> </tr> <tr> <td height="8" width="355"><b> <%If emptyValue = True AND new_cognome = "" Then Response.Write("<font color=""" & errorColor & """>Nome</font>") Else Response.Write("Cognome") End If%> *</b></td> <td height="8" width="622"> <input name="cognome" size="30" maxlength="20" value="<%If emptyValue = True Then Response.Write(Request.Form("Cognome")) Else Response.Write(rs_viewuser("cognome")) End If%>"></td> </tr> <tr> <td width="355"></td> <td width="622"></td> </tr> <tr> <td height="8" width="355"></td> <td height="8" width="622"></td> </tr> <tr> <td width="355"></td> <td width="622"></td> </tr> <tr> <td height="8" width="355"><b> <%If emptyValue = True AND new_password = "" OR badPass = True Then Response.Write("<font color=""" & errorColor & """>Password</font>") Else Response.Write("Password") End If%> *</b></td> <td height="8" width="622"> <input type="password" name="pw1" size="30" maxlength="20" value="<%If emptyValue = True OR badPass = True Then Response.Write(Request.Form("pass")) Else Response.Write(rs_viewuser("pass")) End If%>" <%If str_users_authority <> "admin" AND str_users_name <> rs_viewuser("name") Then%> disabled<%End If%>></td> </tr> <tr> <td width="355"></td> <td width="622"></td> </tr> <tr> <td height="8" width="355"></td> <td height="8" width="622"></td> </tr> <tr> <td width="355"></td> <td width="622"></td> </tr> <tr> <td height="8" width="355"><b> <%If emptyValue = True AND new_password = "" OR badPass = True Then Response.Write("<font color=""" & errorColor & """>Conferma Password</font>") Else Response.Write("Conferma Password") End If%> *</b></td> <td height="8" width="622"> <input type="password" name="pw2" size="30" maxlength="20" value="<%If emptyValue = True OR badPass = True Then Response.Write(Request.Form("pass")) Else Response.Write(rs_viewuser("pass")) End If%>" <%If str_users_authority <> "admin" AND str_users_name <> rs_viewuser("name") Then%> disabled<%End If%>></td> </tr> <tr> <td width="355"></td> <td width="622"></td> </tr> <tr> <td height="8" width="355"></td> <td height="8" width="622"></td> </tr> <tr> <td width="355"><b> <%If emptyValue = True AND new_email = "" Then Response.Write("<font color=""" & errorColor & """>Email</font>") Else Response.Write("Email") End If%> *</b></td> <td width="622"> <input type="text" name="email" size="50" maxlength="50" value="<%If emptyValue = True Then Response.Write(Request.Form("email")) Else Response.Write(rs_viewuser("email")) End If%>"></td> </tr> <tr> <td height="8" width="355"></td> <td height="8" width="622"></td> </tr> <tr> <td height="8" width="355"></td> <td height="8" width="622"></td> </tr> <tr> <td width="355"><b> <%If emptyValue = True AND new_Tel = "" Then Response.Write("<font color=""" & errorColor & """>Tel./Cell.</font>") Else Response.Write("Tel") End If%> *</b></td> <td width="622"> <input type="text" name="Tel" size="30" maxlength="50" value="<%If emptyValue = True Then Response.Write(Request.Form("Tel")) Else Response.Write(rs_viewuser("Tel")) End If%>"></td> </tr> <tr> <td height="8" width="355"></td> <td height="8" width="622"></td> </tr> <tr> <td width="355"></td> <td width="622"></td> </tr> <tr> <td width="355"></td> <td width="622"></td> </tr> <% If str_users_authority = "admin" AND rs_viewuser("authority") <> "admin" Then %> <tr> <td height="8" width="355"><b>Autorizzazione *</b></td> <td height="8" width="622"> <select size="1" name="newauthority" > <option value="mod" <% If rs_viewuser("authority")="mod" OR Request.Form("authority")="mod" Then Response.Write(" selected") End If%>> Moderatore</option> <option value="user" <% If rs_viewuser("authority")="user" OR Request.Form("authority")="user" Then Response.Write(" selected") End If%>> User</option> </select></td> </tr> <tr> <td height="8" width="355"></td> <td height="8" width="622"></td> </tr> <tr> <td height="8" width="355"><b>Stato*</b></td> <td height="8" width="622"> <select size="1" name="userStato" id="userStato" onChange="checkutentesospeso(this)"> <option value="Active" <%If rs_viewuser("stato")="Active" OR Request.Form("stato")="Active" Then Response.Write(" selected") End If%>> Active</option> <option value="Attesa" <%If rs_viewuser("stato")="Attesa" OR Request.Form("stato")="Attesa" Then Response.Write(" selected") End If%>> Attesa</option>stato <option value="Disabled" <%If rs_viewuser("stato")="Disabled" OR Request.Form("stato")="Disabled" Then Response.Write(" selected") End If%>> Sospeso</option> </select></td> </tr> <tr> <td height="8" width="355"></td> <td height="8" width="622"></td> </tr> <tr> <td width="355"> <div id="utentesospesoText"> <%If rs_viewuser("stato")="Disabled" Then%> <b>Ecco perchè il tuo account è stato sospeso*</b></div> <%End If%> </td> <td width="622"> <div id="utentesospesoInputDiv"> <%If rs_viewuser("stato")="Disabled" Then%> <textarea name="utentesospesoInput" rows="3" cols="25"><%If emptyValue = True Then Response.Write(Request.Form("utentesospesoInput")) Else Response.Write(rs_viewuser("utentesospeso")) End If%></textarea> <%End If%> </div></td> </tr> <% End If %> <tr> <td height="8" colspan="2"></td> </tr> <tr> <td colspan="2"> <input type="submit" value="Aggiorna" name="UpdateProfile"> </td> </tr> </table> </div> </form> <% End If %> <% Server.Execute("footer.asp") %>
[
Íàçàä
]