{"id":678,"date":"2011-11-03T00:01:34","date_gmt":"2011-11-02T22:01:34","guid":{"rendered":"http:\/\/www.manuelmarangoni.it\/sir-bit\/?p=678"},"modified":"2019-06-12T14:02:02","modified_gmt":"2019-06-12T12:02:02","slug":"php-creare-uno-strumento-sicuro-per-il-recupero-della-password-dellutente-esempio-completo","status":"publish","type":"post","link":"https:\/\/www.manuelmarangoni.it\/sir-bit\/678\/php-creare-uno-strumento-sicuro-per-il-recupero-della-password-dellutente-esempio-completo\/","title":{"rendered":"PHP &#8211; Creare uno strumento sicuro per il recupero della password dell\u2019utente &#8211; Esempio completo"},"content":{"rendered":"<p>Nel realizzare un qualsiasi form di registrazione, o un\u2019area di accesso in cui l\u2019utente esterno dovr\u00e0 inserire la sua login, dobbiamo prevedere la possibilit\u00e0 che il visitatore possa dimenticare la sua password. Non \u00e8 una cosa poco frequente, soprattutto se l\u2019utente utilizza password diverse per accedere ai suoi vari account: ricordarle tutte pu\u00f2 diventare un\u2019impresa.<\/p>\n<p>Ecco allora che ci torner\u00e0 utile <strong>uno script per recuperare la password dimenticata<\/strong>.<br \/>\nI tipi di approccio sono molteplici: quello che vi vado a presentare \u00e8 solo uno dei tanti e pu\u00f2 essere adattato (e migliorato) in base all\u2019esigenza, magari inserendo la classica \u201cdomanda\u201d a cui l\u2019utente dovr\u00e0 rispondere per ricevere la password direttamente al suo indirizzo email.<br \/>\nIn questo tutorial ho preparato alcune classi di esempio per formattare i campi tramite css: dovrete occuparvi voi di creare il dovuto foglio di stile, in base al layout del vostro sito.<\/p>\n<p>Si d\u00e0 per scontato che abbiate delle conoscenze, almeno di base, nell\u2019uso delle funzioni php e nell\u2019invio email con questo linguaggio. Inoltre \u00e8 utile una conoscenza dell\u2019uso dei database: nell\u2019esempio, infatti, presuppongo che abbiate gli utenti salvati in un database di tipo mysql. Non \u00e8 un passaggio obbligatorio &#8211; potete anche avere user e password elencati in un file &#8211; ma si tratta senz\u2019altro di uno strumento pi\u00f9 efficacie e immediato. In caso contrario, dovrete adattare lo script.<br \/>\nPotete anche prendere lo script cos\u00ec com\u2019\u00e8 e modificare soltanto l\u2019essenziale. Ogni parte \u00e8 dovutamente commentata.<\/p>\n<p>Se siete invece interessati ad <strong>approfondire il tema del login<\/strong>, potete dare un\u2019occhiata <a title=\"PHP - Creare una login sicura e funzionale usando i cookies - Sir Bit\" href=\"https:\/\/www.manuelmarangoni.it\/sir-bit\/343\/php-creare-una-login-sicura-e-funzionale-usando-i-cookies\/\">all\u2019articolo che ho scritto a questo indirizzo<\/a>.<!--more--><\/p>\n\n        <h2>Download script<\/h2>\n        <div style=\"float:left; width:100%; margin-top:60px; margin-bottom:40px;\">\n        <div style=\"float:left; width:100px;\"><img decoding=\"async\" title=\"[PHP] Recupero della password utente &#8211; Esempio completo\" src=\"https:\/\/www.manuelmarangoni.it\/sir-bit\/wp-content\/themes\/sirbit\/images\/redirect_icon.png\" alt=\"[PHP] Recupero della password utente &#8211; Esempio completo\" \/><\/div>\n        <div style=\"float:left; width:350px; padding-top:30px; font-size:14px;\"><strong><a title=\"[PHP] Recupero della password utente &#8211; Esempio completo\" href=\"https:\/\/www.manuelmarangoni.it\/sir-bit\/code\/php-recupero-della-password-utente-esempio-completo\/\">Pagina diretta alla scheda e al download del codice<\/a><\/strong><\/div>\n        <\/div>\n        <div style=\"clear:both;\"> <\/div>\n<h2>Il form di login<\/h2>\n<p>Il nostro form di login, ridotto all\u2019essenziale, avr\u00e0 questa forma:<\/p>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"line_numbers\">\n<pre>1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31<\/pre>\n<\/td>\n<td class=\"code\">\n<pre class=\"html4strict\" style=\"font-family: monospace;\"><span style=\"color: #808080; font-style: italic;\">&lt;!--<\/span>\n<span style=\"color: #808080; font-style: italic;\">Il form \u00e8 solo di esempio. Cliccando sul link in basso si va al file \u201crecupero.php\u201d, che si occupa di recuperare la password.<\/span>\n<span style=\"color: #808080; font-style: italic;\">--&gt;<\/span>\n\n<span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">form<\/span> <span style=\"color: #000066;\">action<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"#form\"<\/span> <span style=\"color: #000066;\">method<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"post\"<\/span> <span style=\"color: #000066;\">id<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"login\"<\/span>&gt;<\/span>\n\n\t<span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">div<\/span> <span style=\"color: #000066;\">class<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"campo_contatti\"<\/span>&gt;<\/span>\n\t\t<span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">div<\/span> <span style=\"color: #000066;\">class<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"voce_campo\"<\/span>&gt;<\/span>* email<span style=\"color: #009900;\">&lt;<span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #000000; font-weight: bold;\">div<\/span>&gt;<\/span>\n\t\t<span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">input<\/span> <span style=\"color: #000066;\">type<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"text\"<\/span> <span style=\"color: #000066;\">name<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"email\"<\/span> <span style=\"color: #000066;\">value<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"&lt;?=@$_POST['email']?&gt;<\/span><\/span>\" class=\"campo\" <span style=\"color: #009900;\">&lt;?php if<span style=\"color: #66cc66;\">(<\/span>!$email || !$password<span style=\"color: #66cc66;\">)<\/span> echo $errore; ?&gt;<\/span> \/&gt;\n\t<span style=\"color: #009900;\">&lt;<span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #000000; font-weight: bold;\">div<\/span>&gt;<\/span>\n\n\t<span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">div<\/span> <span style=\"color: #000066;\">class<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"campo_contatti\"<\/span>&gt;<\/span>\n\t\t<span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">div<\/span> <span style=\"color: #000066;\">class<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"voce_campo\"<\/span>&gt;<\/span>* password<span style=\"color: #009900;\">&lt;<span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #000000; font-weight: bold;\">div<\/span>&gt;<\/span>\n\t\t<span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">input<\/span> <span style=\"color: #000066;\">type<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"password\"<\/span> <span style=\"color: #000066;\">name<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"password\"<\/span> <span style=\"color: #000066;\">value<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"\"<\/span> <span style=\"color: #000066;\">class<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"campo\"<\/span> &lt;?php if<span style=\"color: #66cc66;\">(<\/span>!$email || !$password<span style=\"color: #66cc66;\">)<\/span> echo $errore; ?&gt;<\/span> \/&gt;\n\t<span style=\"color: #009900;\">&lt;<span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #000000; font-weight: bold;\">div<\/span>&gt;<\/span>\n\n\t<span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">div<\/span> <span style=\"color: #000066;\">class<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"clear\"<\/span>&gt;&lt;<span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #000000; font-weight: bold;\">div<\/span>&gt;<\/span>\n\n\t<span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">div<\/span> <span style=\"color: #000066;\">class<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"campo_contatti\"<\/span>&gt;<\/span>\n\t\t<span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">input<\/span> <span style=\"color: #000066;\">type<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"submit\"<\/span> <span style=\"color: #000066;\">value<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"Accedi\"<\/span> <span style=\"color: #66cc66;\">\/<\/span>&gt;<\/span>\n\t<span style=\"color: #009900;\">&lt;<span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #000000; font-weight: bold;\">div<\/span>&gt;<\/span>\n\n\t<span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">div<\/span> <span style=\"color: #000066;\">class<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"clear\"<\/span>&gt;&lt;<span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #000000; font-weight: bold;\">div<\/span>&gt;<\/span>\n\n\t<span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">div<\/span> <span style=\"color: #000066;\">class<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"campo_contatti\"<\/span>&gt;<\/span>\n\t\tHai dimenticato la password? Clicca <span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">a<\/span> <span style=\"color: #000066;\">href<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"recupero.php\"<\/span> <span style=\"color: #000066;\">style<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"color: red\"<\/span>&gt;<\/span>qui<span style=\"color: #009900;\">&lt;<span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #000000; font-weight: bold;\">a<\/span>&gt;<\/span>\n\t<span style=\"color: #009900;\">&lt;<span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #000000; font-weight: bold;\">div<\/span>&gt;<\/span>\n\n\t<span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">div<\/span> <span style=\"color: #000066;\">class<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"clear\"<\/span>&gt;&lt;<span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #000000; font-weight: bold;\">div<\/span>&gt;<\/span>\n\n<span style=\"color: #009900;\">&lt;<span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #000000; font-weight: bold;\">form<\/span>&gt;<\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>Nell&#8217;esempio l\u2019utente deve inserire l&#8217;email e la password per accedere: avremo quindi il dato \u201cemail\u201d gi\u00e0 a disposizione in caso di smarrimento password. Nel caso in cui l\u2019accesso avvenga invece per <em>nickname<\/em>, durante la registrazione dovrete aver predisposto un ulteriore campo per l\u2019inserimento dell\u2019<strong>email, un dato indispensabile per il recupero della password<\/strong>.<\/p>\n<p>In caso di smarrimento della password, l\u2019utente potr\u00e0 cliccare sul link sottostante al form e verr\u00e0 indirizzato al file <code>recupero.php<\/code>.<\/p>\n\n<h2>Form di recupero della password<\/h2>\n<p>Nel file di recupero della password avremo due passaggi chiave:<br \/>\n&#8211; <strong>creazione di un form<\/strong>, dove l\u2019utente scriver\u00e0 la sua email (che corrisponde all\u2019user di accesso) in cui ricever\u00e0 la nuova password;<br \/>\n&#8211; <strong>l\u2019invio dell\u2019email che conterr\u00e0 il link a una nuova pagina<\/strong>, dove confermer\u00e0 la richiesta di una nuova password. La conferma ci \u00e8 necessaria per evitare che un qualsiasi intruso possa richiedere la password di un utente semplicemente conoscendo il suo indirizzo email, digitandolo come indirizzo nel browser.<\/p>\n<p>Come valore univoco per identificare l\u2019utente, prenderemo l\u2019id con cui \u00e8 salvato nel database.<br \/>\nPer chi ha meno dimestichezza, consiglio di dare un\u2019occhiata prima alla parte del form e quindi alla parte riguardante l\u2019invio email.<\/p>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"line_numbers\">\n<pre>1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23<\/pre>\n<\/td>\n<td class=\"code\">\n<pre class=\"php\" style=\"font-family: monospace;\"><span style=\"color: #666666; font-style: italic;\">\/* PARTE DELL\u2019INVIO EMAIL. Si controlla che l'email (=user) sia presente nel db. Estraggo quindi id e password dell'utente e li unisco in un'unica stringa ($hash) da passare nel $_GET. La stringa su cui cliccare \u00e8 inviata per email, come conferma, e rinvia al file \u201cnuova_password.php\u201d. *\/<\/span>\n<span style=\"color: #b1b100;\">if<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #990000;\">isset<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$_POST<\/span><span style=\"color: #009900;\">[<\/span><span style=\"color: #0000ff;\">'email'<\/span><span style=\"color: #009900;\">]<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #009900;\">{<\/span>\n\n\t<span style=\"color: #000088;\">$errore<\/span><span style=\"color: #339933;\">=<\/span><span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #339933;\">;<\/span> <span style=\"color: #666666; font-style: italic;\">\/\/variabile di controllo errori (se rimane a 0 non ci sono errori)<\/span>\n\n\t<span style=\"color: #b1b100;\">if<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$_POST<\/span><span style=\"color: #009900;\">[<\/span><span style=\"color: #0000ff;\">'email'<\/span><span style=\"color: #009900;\">]<\/span><span style=\"color: #339933;\">==<\/span><span style=\"color: #0000ff;\">\"\"<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #009900;\">{<\/span>\n\t\t<span style=\"color: #000088;\">$errore<\/span><span style=\"color: #339933;\">=<\/span><span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #339933;\">;<\/span>\n\t<span style=\"color: #009900;\">}<\/span><span style=\"color: #b1b100;\">else<\/span><span style=\"color: #009900;\">{<\/span>\n\t\t<span style=\"color: #000088;\">$result<\/span><span style=\"color: #339933;\">=<\/span><span style=\"color: #990000;\">mysql_query<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #0000ff;\">\"select id, password from utenti where email='\"<\/span><span style=\"color: #339933;\">.<\/span><span style=\"color: #000088;\">$_POST<\/span><span style=\"color: #009900;\">[<\/span><span style=\"color: #0000ff;\">'email'<\/span><span style=\"color: #009900;\">]<\/span><span style=\"color: #339933;\">.<\/span><span style=\"color: #0000ff;\">\"' limit 0,1\"<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #000088;\">$db<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">;<\/span>\n\n\t\t<span style=\"color: #b1b100;\">if<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #990000;\">mysql_num_rows<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$result<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">&gt;<\/span><span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #009900;\">{<\/span>\n\t\t\t<span style=\"color: #000088;\">$row<\/span><span style=\"color: #339933;\">=<\/span><span style=\"color: #990000;\">mysql_fetch_array<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$result<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">;<\/span>\n\n\t\t\t<span style=\"color: #666666; font-style: italic;\">\/\/l\u2019hash ci servir\u00e0 per recuperare i dati utente e confermare la richiesta<\/span>\n\t\t\t<span style=\"color: #666666; font-style: italic;\">\/\/la password nel database si presume criptata, con md5 o altro algoritmo<\/span>\n\t\t\t<span style=\"color: #666666; font-style: italic;\">\/\/al posto di questi due dati, se ne possono usare altri legati all\u2019utente, purch\u00e9 univoci<\/span>\n\t\t\t<span style=\"color: #000088;\">$hash<\/span><span style=\"color: #339933;\">=<\/span><span style=\"color: #000088;\">$row<\/span><span style=\"color: #009900;\">[<\/span><span style=\"color: #0000ff;\">'password'<\/span><span style=\"color: #009900;\">]<\/span><span style=\"color: #339933;\">.<\/span><span style=\"color: #0000ff;\">\"\"<\/span><span style=\"color: #339933;\">.<\/span><span style=\"color: #000088;\">$row<\/span><span style=\"color: #009900;\">[<\/span><span style=\"color: #0000ff;\">'id'<\/span><span style=\"color: #009900;\">]<\/span><span style=\"color: #339933;\">;<\/span>\n\n\t\t<span style=\"color: #009900;\">}<\/span><span style=\"color: #b1b100;\">else<\/span>\n\t\t\t<span style=\"color: #000088;\">$errore<\/span><span style=\"color: #339933;\">=<\/span><span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #339933;\">;<\/span>\n\n\t<span style=\"color: #009900;\">}<\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"line_numbers\">\n<pre>1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27<\/pre>\n<\/td>\n<td class=\"code\">\n<pre class=\"php\" style=\"font-family: monospace;\">\t<span style=\"color: #666666; font-style: italic;\">\/\/se non ci sono stati errori, invio l\u2019email all\u2019utente con il link da confermare<\/span>\n\t<span style=\"color: #b1b100;\">if<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$errore<\/span><span style=\"color: #339933;\">==<\/span><span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #009900;\">{<\/span>\n\n\t\t<span style=\"color: #000088;\">$header<\/span><span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000ff;\">\"From: sito.it &lt;info@sito.it&gt;<span style=\"color: #000099; font-weight: bold;\">\\n<\/span>\"<\/span><span style=\"color: #339933;\">;<\/span>\n\t\t<span style=\"color: #000088;\">$header<\/span> <span style=\"color: #339933;\">.=<\/span> <span style=\"color: #0000ff;\">\"Content-Type: text\/html; charset=<span style=\"color: #000099; font-weight: bold;\">\\\"<\/span>iso-8859-1<span style=\"color: #000099; font-weight: bold;\">\\\"<\/span><span style=\"color: #000099; font-weight: bold;\">\\n<\/span>\"<\/span><span style=\"color: #339933;\">;<\/span>\n\t\t<span style=\"color: #000088;\">$header<\/span> <span style=\"color: #339933;\">.=<\/span> <span style=\"color: #0000ff;\">\"Content-Transfer-Encoding: 7bit<span style=\"color: #000099; font-weight: bold;\">\\n<\/span><span style=\"color: #000099; font-weight: bold;\">\\n<\/span>\"<\/span><span style=\"color: #339933;\">;<\/span>\n\n\t\t<span style=\"color: #000088;\">$subject<\/span><span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000ff;\">\"sito.it - Nuova password utente\"<\/span><span style=\"color: #339933;\">;<\/span>\n\n\t\t<span style=\"color: #000088;\">$mess_invio<\/span><span style=\"color: #339933;\">=<\/span><span style=\"color: #0000ff;\">\"&lt;html&gt;&lt;body&gt;\"<\/span><span style=\"color: #339933;\">;<\/span>\n\t\t<span style=\"color: #000088;\">$mess_invio<\/span><span style=\"color: #339933;\">.=<\/span><span style=\"color: #0000ff;\">\" Clicca sul &lt;a href=<span style=\"color: #000099; font-weight: bold;\">\\\"<\/span>http:\/\/www.sito.it\/nuova_password.php?hash=\"<\/span><span style=\"color: #339933;\">.<\/span><span style=\"color: #000088;\">$hash<\/span><span style=\"color: #339933;\">.<\/span><span style=\"color: #0000ff;\">\"<span style=\"color: #000099; font-weight: bold;\">\\\"<\/span>&gt;link&lt;\/a&gt; per confermare la nuova password.&lt;br \/&gt; Se il link non \u00e8 visibile, copia la riga qui sotto e incollala sul tuo browser: &lt;br \/&gt; http:\/\/www.sito.it\/nuova_password.php?hash=\"<\/span><span style=\"color: #339933;\">.<\/span><span style=\"color: #000088;\">$hash<\/span><span style=\"color: #339933;\">.<\/span><span style=\"color: #0000ff;\">\" \"<\/span><span style=\"color: #339933;\">;<\/span>\n\t\t<span style=\"color: #000088;\">$mess_invio<\/span><span style=\"color: #339933;\">.=<\/span><span style=\"color: #0000ff;\">'&lt;\/body&gt;&lt;html&gt;'<\/span><span style=\"color: #339933;\">;<\/span>\n\n\t\t<span style=\"color: #666666; font-style: italic;\">\/\/invio email<\/span>\n\t\t<span style=\"color: #b1b100;\">if<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #339933;\">@<\/span><span style=\"color: #990000;\">mail<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$_POST<\/span><span style=\"color: #009900;\">[<\/span><span style=\"color: #0000ff;\">'email'<\/span><span style=\"color: #009900;\">]<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #000088;\">$subject<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #000088;\">$mess_invio<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #000088;\">$header<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #009900;\">{<\/span>\n\n\t\t\t<span style=\"color: #b1b100;\">echo<\/span> <span style=\"color: #0000ff;\">\"&lt;div class=<span style=\"color: #000099; font-weight: bold;\">\\\"<\/span>campo_contatti<span style=\"color: #000099; font-weight: bold;\">\\\"<\/span> style=<span style=\"color: #000099; font-weight: bold;\">\\\"<\/span>margin-left: 20px; height: 300px<span style=\"color: #000099; font-weight: bold;\">\\\"<\/span>&gt;\"<\/span><span style=\"color: #339933;\">;<\/span>\n\t\t\t<span style=\"color: #b1b100;\">echo<\/span> <span style=\"color: #0000ff;\">\"Email inviata con successo. Controlla la tua email&lt;br \/&gt;&lt;br \/&gt;\"<\/span><span style=\"color: #339933;\">;<\/span>\n\n\t\t\t<span style=\"color: #b1b100;\">echo<\/span> <span style=\"color: #0000ff;\">\"&lt;\/div&gt; &lt;div class=<span style=\"color: #000099; font-weight: bold;\">\\\"<\/span>clear<span style=\"color: #000099; font-weight: bold;\">\\\"<\/span>&gt;&lt;\/div&gt;\"<\/span><span style=\"color: #339933;\">;<\/span>\n\t\t\t<span style=\"color: #990000;\">unset<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$_POST<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">;<\/span> <span style=\"color: #666666; font-style: italic;\">\/\/elimino le variabili post, in modo che non appaiano nel form<\/span>\n\n\t\t<span style=\"color: #009900;\">}<\/span>\n\n\t<span style=\"color: #009900;\">}<\/span>\n\n<span style=\"color: #009900;\">}<\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"line_numbers\">\n<pre>1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21<\/pre>\n<\/td>\n<td class=\"code\">\n<pre class=\"html4strict\" style=\"font-family: monospace;\"><span style=\"color: #808080; font-style: italic;\">&lt;!-- FORM BASE<\/span>\n<span style=\"color: #808080; font-style: italic;\">L'utente inserisce la sua email (che dovr\u00e0 corrispondere a quella salvata nel database).<\/span>\n<span style=\"color: #808080; font-style: italic;\">--&gt;<\/span>\n\n<span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">form<\/span> <span style=\"color: #000066;\">action<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"\"<\/span> <span style=\"color: #000066;\">method<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"post\"<\/span> <span style=\"color: #000066;\">id<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"login\"<\/span>&gt;<\/span>\n\n\t<span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">div<\/span> <span style=\"color: #000066;\">class<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"campo_contatti\"<\/span>&gt;<\/span>\n\t\t<span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">div<\/span> <span style=\"color: #000066;\">class<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"voce_campo\"<\/span>&gt;<\/span>Inserisci la tua email per ricevere la nuova password<span style=\"color: #009900;\">&lt;<span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #000000; font-weight: bold;\">div<\/span>&gt;<\/span>\n\t\t<span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">input<\/span> <span style=\"color: #000066;\">type<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"text\"<\/span> <span style=\"color: #000066;\">name<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"email\"<\/span> <span style=\"color: #000066;\">value<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"&lt;?=@$_POST['email']?&gt;<\/span><\/span>\" class=\"campo\" \/&gt;\n\t<span style=\"color: #009900;\">&lt;<span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #000000; font-weight: bold;\">div<\/span>&gt;<\/span>\n\n\t<span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">div<\/span> <span style=\"color: #000066;\">class<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"clear\"<\/span>&gt;&lt;<span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #000000; font-weight: bold;\">div<\/span>&gt;<\/span>\n\n\t<span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">div<\/span> <span style=\"color: #000066;\">class<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"campo_contatti\"<\/span>&gt;<\/span>\n\t\t<span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">input<\/span> <span style=\"color: #000066;\">type<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"submit\"<\/span> <span style=\"color: #000066;\">value<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"invia\"<\/span> <span style=\"color: #66cc66;\">\/<\/span>&gt;<\/span>\n\t<span style=\"color: #009900;\">&lt;<span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #000000; font-weight: bold;\">div<\/span>&gt;<\/span>\n\n\t<span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">div<\/span> <span style=\"color: #000066;\">class<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"clear\"<\/span>&gt;&lt;<span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #000000; font-weight: bold;\">div<\/span>&gt;<\/span>\n\n<span style=\"color: #009900;\">&lt;<span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #000000; font-weight: bold;\">form<\/span>&gt;<\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h2>Conferma della password<\/h2>\n<p>Una volta ricevuta l\u2019email e cliccato sul link di conferma password, l\u2019utente sar\u00e0 indirizzato alla pagina <code>nuova_password.php<\/code>, dove sar\u00e0 passata anche una variabile get contenente la vecchia password (criptata) e l\u2019id dell\u2019utente salvato nel database.<br \/>\nAnche qui i passaggi sono pochi:<br \/>\n&#8211; divido la variabile $hash nei suoi due componenti (vecchia password e id)<br \/>\n&#8211; creo una nuova password a random e la salvo nel database al posto di quella vecchia<br \/>\n&#8211; invio all\u2019email dell\u2019utente la nuova password creata<\/p>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"line_numbers\">\n<pre>1\n2\n3\n4\n5\n6\n7\n8\n9\n10<\/pre>\n<\/td>\n<td class=\"code\">\n<pre class=\"php\" style=\"font-family: monospace;\"><span style=\"color: #000000; font-weight: bold;\">&lt;?php<\/span>\n<span style=\"color: #666666; font-style: italic;\">\/\/funzione che crea una password random<\/span>\n<span style=\"color: #000000; font-weight: bold;\">function<\/span> random<span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$lunghezza<\/span><span style=\"color: #339933;\">=<\/span><span style=\"color: #cc66cc;\">12<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #009900;\">{<\/span>\n\t<span style=\"color: #000088;\">$caratteri_disponibili<\/span> <span style=\"color: #339933;\">=<\/span><span style=\"color: #0000ff;\">\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890\"<\/span><span style=\"color: #339933;\">;<\/span>\n\t<span style=\"color: #000088;\">$codice<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000ff;\">\"\"<\/span><span style=\"color: #339933;\">;<\/span>\n\t<span style=\"color: #b1b100;\">for<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$i<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #339933;\">;<\/span> <span style=\"color: #000088;\">$i<\/span><span style=\"color: #339933;\">&lt;<\/span><span style=\"color: #000088;\">$lunghezza<\/span><span style=\"color: #339933;\">;<\/span> <span style=\"color: #000088;\">$i<\/span><span style=\"color: #339933;\">++<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #009900;\">{<\/span>\n\t\t<span style=\"color: #000088;\">$codice<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #000088;\">$codice<\/span><span style=\"color: #339933;\">.<\/span><span style=\"color: #990000;\">substr<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$caratteri_disponibili<\/span><span style=\"color: #339933;\">,<\/span><span style=\"color: #990000;\">rand<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #339933;\">,<\/span><span style=\"color: #990000;\">strlen<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$caratteri_disponibili<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">-<\/span><span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">,<\/span><span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">;<\/span>\n\t<span style=\"color: #009900;\">}<\/span>\n\t<span style=\"color: #b1b100;\">return<\/span> <span style=\"color: #000088;\">$codice<\/span><span style=\"color: #339933;\">;<\/span>\n<span style=\"color: #009900;\">}<\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"line_numbers\">\n<pre>1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43<\/pre>\n<\/td>\n<td class=\"code\">\n<pre class=\"php\" style=\"font-family: monospace;\"><span style=\"color: #000000; font-weight: bold;\">&lt;?php<\/span>\n<span style=\"color: #666666; font-style: italic;\">\/\/il controllo del get evita errori di pagina<\/span>\n\n<span style=\"color: #b1b100;\">if<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #990000;\">isset<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$_GET<\/span><span style=\"color: #009900;\">[<\/span><span style=\"color: #0000ff;\">'hash'<\/span><span style=\"color: #009900;\">]<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #009900;\">{<\/span>\n\n\t<span style=\"color: #000088;\">$hash<\/span><span style=\"color: #339933;\">=<\/span><span style=\"color: #000088;\">$_GET<\/span><span style=\"color: #009900;\">[<\/span><span style=\"color: #0000ff;\">'hash'<\/span><span style=\"color: #009900;\">]<\/span><span style=\"color: #339933;\">;<\/span>\n\n\t<span style=\"color: #000088;\">$id<\/span><span style=\"color: #339933;\">=<\/span><span style=\"color: #990000;\">substr<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$hash<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #cc66cc;\">32<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">;<\/span>\n\t<span style=\"color: #000088;\">$password_old<\/span><span style=\"color: #339933;\">=<\/span><span style=\"color: #990000;\">substr<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$hash<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #cc66cc;\">32<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">;<\/span>\n\n\t<span style=\"color: #000088;\">$password<\/span><span style=\"color: #339933;\">=<\/span>random<span style=\"color: #009900;\">(<\/span><span style=\"color: #cc66cc;\">8<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">;<\/span> <span style=\"color: #666666; font-style: italic;\">\/\/nuova password di 8 caratteri<\/span>\n\n\t<span style=\"color: #666666; font-style: italic;\">\/\/controllo che i valori dell\u2019hash corrispondano ai valori salvati nel database<\/span>\n\t<span style=\"color: #000088;\">$result<\/span><span style=\"color: #339933;\">=<\/span><span style=\"color: #990000;\">mysql_query<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #0000ff;\">\"SELECT * FROM utenti WHERE id=\"<\/span><span style=\"color: #339933;\">.<\/span><span style=\"color: #000088;\">$id<\/span><span style=\"color: #339933;\">.<\/span><span style=\"color: #0000ff;\">\" AND password='\"<\/span><span style=\"color: #339933;\">.<\/span><span style=\"color: #000088;\">$password_old<\/span><span style=\"color: #339933;\">.<\/span><span style=\"color: #0000ff;\">\"'\"<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #000088;\">$db<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">;<\/span>\n\n\t<span style=\"color: #b1b100;\">if<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #990000;\">mysql_num_rows<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$result<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">&gt;<\/span><span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #009900;\">{<\/span> \n\n\t\t<span style=\"color: #000088;\">$row<\/span><span style=\"color: #339933;\">=<\/span><span style=\"color: #990000;\">mysql_fetch_array<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$result<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">;<\/span>\n\n\t\t<span style=\"color: #000088;\">$email<\/span><span style=\"color: #339933;\">=<\/span><span style=\"color: #000088;\">$row<\/span><span style=\"color: #009900;\">[<\/span><span style=\"color: #0000ff;\">'email'<\/span><span style=\"color: #009900;\">]<\/span><span style=\"color: #339933;\">;<\/span>\n\n\t\t<span style=\"color: #666666; font-style: italic;\">\/\/salvo la nuova password al posto della vecchia (in md5)<\/span>\n\t\t<span style=\"color: #000088;\">$result<\/span><span style=\"color: #339933;\">=<\/span><span style=\"color: #990000;\">mysql_query<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #0000ff;\">\"update <\/span><span style=\"color: #0000ff;\">utenti set password='\"<\/span><span style=\"color: #339933;\">.<\/span><span style=\"color: #990000;\">md5<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$password<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">.<\/span><span style=\"color: #0000ff;\">\"' where id=\"<\/span><span style=\"color: #339933;\">.<\/span><span style=\"color: #000088;\">$id<\/span><span style=\"color: #339933;\">.<\/span><span style=\"color: #0000ff;\">\" and password='\"<\/span><span style=\"color: #339933;\">.<\/span><span style=\"color: #000088;\">$password_old<\/span><span style=\"color: #339933;\">.<\/span><span style=\"color: #0000ff;\">\"'\"<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #000088;\">$db<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">;<\/span>\n\n\t\t<span style=\"color: #000088;\">$header<\/span><span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000ff;\">\"From: sito.it &lt;info@sito.it&gt;<span style=\"color: #000099; font-weight: bold;\">\\n<\/span>\"<\/span><span style=\"color: #339933;\">;<\/span>\n\t\t<span style=\"color: #000088;\">$header<\/span> <span style=\"color: #339933;\">.=<\/span> <span style=\"color: #0000ff;\">\"Content-Type: text\/html; charset=<span style=\"color: #000099; font-weight: bold;\">\\\"<\/span>iso-8859-1<span style=\"color: #000099; font-weight: bold;\">\\\"<\/span><span style=\"color: #000099; font-weight: bold;\">\\n<\/span>\"<\/span><span style=\"color: #339933;\">;<\/span>\n\t\t<span style=\"color: #000088;\">$header<\/span> <span style=\"color: #339933;\">.=<\/span> <span style=\"color: #0000ff;\">\"Content-Transfer-Encoding: 7bit<span style=\"color: #000099; font-weight: bold;\">\\n<\/span><span style=\"color: #000099; font-weight: bold;\">\\n<\/span>\"<\/span><span style=\"color: #339933;\">;<\/span>\n\n\t\t<span style=\"color: #000088;\">$subject<\/span><span style=\"color: #339933;\">=<\/span> <span style=\"color: #0000ff;\">\"sito.it - Nuova password utente\"<\/span><span style=\"color: #339933;\">;<\/span>\n\n\t\t<span style=\"color: #000088;\">$mess_invio<\/span><span style=\"color: #339933;\">=<\/span><span style=\"color: #0000ff;\">\"&lt;html&gt;&lt;body&gt;\"<\/span><span style=\"color: #339933;\">;<\/span>\n\t\t<span style=\"color: #000088;\">$mess_invio<\/span><span style=\"color: #339933;\">.=<\/span><span style=\"color: #0000ff;\">\" La sua nuova password utente \u00e8 \"<\/span><span style=\"color: #339933;\">.<\/span><span style=\"color: #000088;\">$password<\/span><span style=\"color: #339933;\">.<\/span><span style=\"color: #0000ff;\">\"&lt;br \/&gt; Ora puoi accedere all'area &lt;a href=<span style=\"color: #000099; font-weight: bold;\">\\\"<\/span>http:\/\/www.sito.it\/login.php<span style=\"color: #000099; font-weight: bold;\">\\\"<\/span> style=<span style=\"color: #000099; font-weight: bold;\">\\\"<\/span>color: red<span style=\"color: #000099; font-weight: bold;\">\\\"<\/span>&gt;Login&lt;\/a&gt;. \"<\/span><span style=\"color: #339933;\">;<\/span>\n\t\t<span style=\"color: #000088;\">$mess_invio<\/span><span style=\"color: #339933;\">.=<\/span><span style=\"color: #0000ff;\">'&lt;\/body&gt;&lt;html&gt;'<\/span><span style=\"color: #339933;\">;<\/span>\n\n\t\t<span style=\"color: #b1b100;\">if<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #339933;\">@<\/span><span style=\"color: #990000;\">mail<\/span><span style=\"color: #009900;\">(<\/span><span style=\"color: #000088;\">$email<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #000088;\">$subject<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #000088;\">$mess_invio<\/span><span style=\"color: #339933;\">,<\/span> <span style=\"color: #000088;\">$header<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #009900;\">{<\/span><span style=\"color: #000000; font-weight: bold;\">?&gt;<\/span>\n\t\t\tLa password \u00e8 stata cambiata con successo. Controlla la tua email.&lt;br \/&gt;&lt;br \/&gt; \n\t\t<span style=\"color: #000000; font-weight: bold;\">&lt;?php<\/span>\n\t\t<span style=\"color: #009900;\">}<\/span>\n\n\t<span style=\"color: #009900;\">}<\/span>\n\n<span style=\"color: #009900;\">}<\/span> <span style=\"color: #666666; font-style: italic;\">\/\/if(isset($_GET['hash']))<\/span>\n<span style=\"color: #000000; font-weight: bold;\">?&gt;<\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Vediamo come creare uno script sicuro per permettere all&#8217;utente di recuperare la propria password smarrita. L&#8217;utente dovr\u00e0 confermare la ricezione tramite email.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[78],"tags":[32,4,6,46],"class_list":["post-678","post","type-post","status-publish","format-standard","hentry","category-php-mysql","tag-mysql","tag-php","tag-script","tag-tutorial","cat-78-id"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.manuelmarangoni.it\/sir-bit\/wp-json\/wp\/v2\/posts\/678"}],"collection":[{"href":"https:\/\/www.manuelmarangoni.it\/sir-bit\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.manuelmarangoni.it\/sir-bit\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.manuelmarangoni.it\/sir-bit\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.manuelmarangoni.it\/sir-bit\/wp-json\/wp\/v2\/comments?post=678"}],"version-history":[{"count":22,"href":"https:\/\/www.manuelmarangoni.it\/sir-bit\/wp-json\/wp\/v2\/posts\/678\/revisions"}],"predecessor-version":[{"id":2527,"href":"https:\/\/www.manuelmarangoni.it\/sir-bit\/wp-json\/wp\/v2\/posts\/678\/revisions\/2527"}],"wp:attachment":[{"href":"https:\/\/www.manuelmarangoni.it\/sir-bit\/wp-json\/wp\/v2\/media?parent=678"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.manuelmarangoni.it\/sir-bit\/wp-json\/wp\/v2\/categories?post=678"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.manuelmarangoni.it\/sir-bit\/wp-json\/wp\/v2\/tags?post=678"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}