dati di accesso dimenticati

fabrizio74

Nuovo Utente
5 Set 2012
13
0
0
Salve a tutti, premetto che sono nuovo del forum e alle prime armi con il php. Sto cercando di terminare il sito per la mia squadra di basket in carrozzina (www.asdo.it) e lo sto facendo con Dreamweaver CS5. Il problema che da alcuni giorni non riesco proprio a risolvere, è quello dei dati di accesso dimenticati da parte dell' utente iscritto, praticamente a far pervenire all' utente l' email con i dati di accesso qualora lo richiedesse dalla pagina login. Sto cercando di farlo tramite la funzione "mail" ma non riesco a far pescare la username e password dal database, quindi all' utente arriva l' email con oggetto e descrizione ma senza i dati di accesso. Vi chiedevo se qualcuno potesse aiutarmi per il codice esatto, considerando che ho creato una pagina con l'inserimento dell'email dell'utente che dopo l'invio porta alla pagina di recupero dati.
ps.
questa è la funzione mail che ho messo nella pagina "recupero dati":
PHP:
<?php
$mittente = 'from:"utenti asdo"<[email protected]>';
$a="$Mail";
$oggetto="recupero dati di accesso";
$messaggio="Di seguito i dati per accedere:\n";
$messaggio .="Username: $Username\n";
$messaggio .="Password: $Password\n\n";

mail($a, $oggetto, $messaggio, $mittente, 'From: '.$Mail.'');
?>
 
Ultima modifica di un moderatore:

minatore

Utente Attivo
25 Set 2007
410
0
0

Ciao, posta, l'intero codice della pagina, ci dovrebbe essere prima di quello che hai postato una select per estrarre i dati, inoltre volevo chiederti come la salvi la pwd, normale o criptata.
Ciao
 

fabrizio74

Nuovo Utente
5 Set 2012
13
0
0
Ciao! grazie mille per la risposta,
come mi hai chiesto ecco l 'intero codice, mentre per la password la salvo normale.
PHP:
<?php
$mittente = 'from:"utenti asdo"<[email protected]>';
$a="$Mail";
$oggetto="recupero dati di accesso";
$messaggio="Di seguito i dati per accedere:\n";
$messaggio .="Username: $Username\n";
$messaggio .="Password: $Password\n\n";

mail($a, $oggetto, $messaggio, $mittente, 'From: '.$Mail.'');
?>
<?php require_once('../Connections/asdo.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$colname_recup = "-1";
if (isset($_POST['Mail'])) {
  $colname_recup = $_POST['Mail'];
}
mysql_select_db($database_asdo, $asdo);
$query_recup = sprintf("SELECT Username, Password FROM utenti WHERE Mail = %s", GetSQLValueString($colname_recup, "text"));
$recup = mysql_query($query_recup, $asdo) or die(mysql_error());
$row_recup = mysql_fetch_assoc($recup);
$totalRows_recup = mysql_num_rows($recup);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>link ASDO Don Orione Roma - basket in carrozzina</title>
<style type="text/css">
.sfondo {
	text-align: center;
	background-image: url(../sfondo.jpg);
	background-attachment: fixed;
	background-position: center;
}
.titolo_pagina {
	font-size: 36px;
	color: #033;
	text-shadow: 2px 1px 5px #;
	background-color: #FFF;
	font-family: arial;
	text-shadow: 2px 2px 7px #729053;
}
.menu_principale {
	font-family: arial;
	font-size: 18px;
	color: #033;
	background-color: #FFF;
	text-shadow: 2px 2px 2px #729053;
}
.myasdo_accedi_registrati {
	font-size: 14px;
	background-color: #DCFFD0;
	font-family: arial;
}
.myasdo {
	background-color: #DCFFD0;
}
.titoli_tabelle {
	font-size: 16px;
	color: #033;
	background-color: #FFF;
	font-family: arial;
}
.pie_di_pagina {
	font-size: 16px;
	color: #FFF;
	text-shadow: 2px 2px 2px #033;
}
a:link {
	text-decoration: none;
	color: #033;
}
.facebook {
	background-color: #FFF;
}
body,td,th {
	font-family: arial;
}
a:visited {
	text-decoration: none;
	color: #033;
}
.corpo_pagina {
	font-family: arial;
	color: #033;
	background-color: #FFF;
	text-align: center;
}
a:hover {
	color: #730315;
	text-decoration: none;
}
.sponsor {
	background-color: #FFF;
}
</style>
<script type="text/javascript">
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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 MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
</head>

<body class="sfondo" onload="MM_preloadImages('../CONTENUTI/OGGETTI HOME/myasdo2roll.gif')">
<div align="center">
  <table width="903">
    <tr>
      <td><img src="http://forum.mrwebmaster.it/barra top.jpg" width="899" height="140" align="middle" /></td>
    </tr>
  </table>
  <table width="903" height="34" border="0" align="center">
    <tr class="menu_principale">
      <td width="866" height="25" align="center" valign="middle" class="menu_principale"><a href="http://forum.mrwebmaster.it/index.php">home</a> ****<a href="http://forum.mrwebmaster.it/CONTENUTI/news.php">news</a> ****<a href="http://forum.mrwebmaster.it/CONTENUTI/campionato.php">campionato</a>**** <a href="http://forum.mrwebmaster.it/CONTENUTI/squadra.php">squadra</a>**** <a href="http://forum.mrwebmaster.it/CONTENUTI/societa.php">società</a>**** <a href="http://forum.mrwebmaster.it/CONTENUTI/storia.php">storia</a> ****<a href="http://forum.mrwebmaster.it/CONTENUTI/gallerie.php">gallerie</a> ****<a href="http://forum.mrwebmaster.it/CONTENUTI/link.php">link</a> ****<a href="http://forum.mrwebmaster.it/CONTENUTI/5xmille.php">5xmille</a> ****<a href="http://forum.mrwebmaster.it/CONTENUTI/dove siamo.php">dove siamo</a></td>
      <td width="27" height="25" align="center" valign="middle" class="facebook"><a href="http://www.facebook.com/pages/ASDO-Don-Orione/415035968514242"><img src="http://forum.mrwebmaster.it/CONTENUTI/OGGETTI HOME/facebook.gif" alt="" width="25" height="25" align="middle" /></a></td>
    </tr>
  </table>
  <table width="903" height="51" border="0">
    <tr valign="top">
      <td width="742" height="18" rowspan="2" align="center" valign="middle" class="titolo_pagina"><div align="center"><strong class="titolo_pagina1" id="news">recupero dati</strong></div></td>
      <td width="149" height="30" align="center" valign="middle" class="myasdo"><a href="http://forum.mrwebmaster.it/CONTENUTI/myasdo.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image7','','../CONTENUTI/OGGETTI HOME/myasdo2roll.gif',1)"><img src="http://forum.mrwebmaster.it/CONTENUTI/OGGETTI HOME/myasdo2.gif" alt="" name="Image7" width="135" height="24" border="0" id="Image7" /></a><a href="http://forum.mrwebmaster.it/CONTENUTI/myasdo.php"></a></td>
    </tr>
    <tr valign="middle">
      <td height="20" align="center" valign="middle" nowrap="nowrap" class="myasdo_accedi_registrati"><a href="autenticazione utente.php">login</a> * ****<a href="registrazione.php">registrati</a></td>
    </tr>
  </table>
  <table width="903" border="0">
    <tr>
      <td height="500" valign="top" class="corpo_pagina"><p>&nbsp;</p>
        <p></p>
        <p></p>
        <p align="center">    
	    </p>
        <p align="center">Al più presto riceverai un' e-mail con i dati di accesso...</p>
      <p align="center">&nbsp;</p><p align="center">&nbsp;</p></td>
    </tr>
  </table>
  <table width="903" height="178" border="0" align="center" cellpadding="3">
    <tr valign="bottom" class="titoli_tabelle">
      <td height="20" align="center" nowrap="nowrap"><strong class="titoli_tabelle">sponsor</strong></td>
    </tr>
    <tr class="sponsor">
      <td height="150" align="center" valign="top"><a href="http://ocres.webprofessional.it"><img src="http://forum.mrwebmaster.it/CONTENUTI/LOGHI SPONSOR/ocres.jpg" width="150" height="150" hspace="30" /></a> <a href="http://www.primspa.com/"><img src="http://forum.mrwebmaster.it/CONTENUTI/LOGHI SPONSOR/prim.jpg" width="150" height="150" hspace="30" vspace="0" /></a><a href="http://www.fondazioneroma-terzosettore.it/it/index.html"><img src="http://forum.mrwebmaster.it/CONTENUTI/LOGHI SPONSOR/fondazioneromaterzosettore.jpg" width="150" height="150" hspace="30" /></a><a href="http://www.gruppopellegrini.it/"><img src="http://forum.mrwebmaster.it/CONTENUTI/LOGHI SPONSOR/pellegrinispa.jpg" width="150" height="150" hspace="30" /></a>
        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"></td>
    </tr>
  </table>
  <br />
  <span class="pie_di_pagina">Associazione Sportiva Disabili Don Orione<br />
Via della Camilluccia 112/120, cap. 00135, Roma<br />
Tel. 06-355291</span></div>
<div align="center"></div>
</body>
</html>
<?php
mysql_free_result($recup);
?>
 
Ultima modifica di un moderatore:

minatore

Utente Attivo
25 Set 2007
410
0
0

Ciao, prima fai una copia dell'originale e conservala, visto che proveremo solo la parte del php.
PHP:
if (isset($_POST['Mail']))
{
 mysql_select_db($database_asdo, $asdo);
$query=mysql_query("SELECT * FROM utenti WHERE id_utente = '1'")
$row_recup = mysql_fetch_assoc($quey);
$Username=$row_recup['Username'];
$Password=$row_recup['Password'];
$mittente = 'from:"utenti asdo"<[email protected]>'; 
$a="xxx"; //destinatario
$oggetto="recupero dati di accesso"; 
$messaggio="$Username,$Password"; 
mail($a, $oggetto, $messaggio, $mittente);
}
Inserisci solo questa parte di codice nella pagina, poi vai alla pagina di richiesta dati accesso e clicca suul bottone, senza scrivere la mail del richiedente, controlla i campi della query, nel campo $a inserisci la mail del destinatario, ti dovrebbe restituire username e password dell'id_utente 1
fammi sapere se va, ciao.
Nel documento che hai linkato c'è troppa roba, ho preso solo la parte attiva.
Ciao

 

fabrizio74

Nuovo Utente
5 Set 2012
13
0
0
Ciao, penso e spero di aver fatto quello che mi hai indicato, cmq quando clicco sul pulsante per l'invio mi esce:

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /web/htdocs/www.asdo.it/home/SESSIONE UTENTI/recupero dati ok.php on line 4

Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /web/htdocs/www.asdo.it/home/SESSIONE UTENTI/recupero dati ok.php on line 5

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /web/htdocs/www.asdo.it/home/SESSIONE UTENTI/recupero dati ok.php on line 5

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /web/htdocs/www.asdo.it/home/SESSIONE UTENTI/recupero dati ok.php on line 6


mentre l' email arriva con oggetto e mittente ma nel corpo stampa solo la virgola di separazione senza Username e Password
 

minatore

Utente Attivo
25 Set 2007
410
0
0

Ciao, molto probabilmente c'è un errore di connessione al db, verifica se hai impostato nella pagina il codice di connessione, poi ti assicuri anche se nel db utente esiste l'id_utente 1.
Per fare prima posta la nuova pagina tra i tag del forum, non linkarla.
Ciao da minatore
 

fabrizio74

Nuovo Utente
5 Set 2012
13
0
0
ti ringrazio per la pazienza sei molto gentile, riguardo il codice di connessione non so che dirti anche se per tutte le altre pagine sembra che funge, mentre per l'id_utente 1 al momento è l'unico che ho inserito nel db, cmq ora gli errori non escono ma l'email arriva ancora senza Username e Password.

PHP:
<?php require_once('../Connections/asdo.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$colname_recup = "-1";
if (isset($_POST['Mail'])) {
  $colname_recup = $_POST['Mail'];
}
mysql_select_db($database_asdo, $asdo);
$query_recup = sprintf("SELECT Username, Password FROM utenti WHERE Mail = %s", GetSQLValueString($colname_recup, "text"));
$recup = mysql_query($query_recup, $asdo) or die(mysql_error());
$row_recup = mysql_fetch_assoc($recup);
$totalRows_recup = mysql_num_rows($recup);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>link ASDO Don Orione Roma - basket in carrozzina</title>
<style type="text/css">
.sfondo {
	text-align: center;
	background-image: url(../sfondo.jpg);
	background-attachment: fixed;
	background-position: center;
}
.titolo_pagina {
	font-size: 36px;
	color: #033;
	text-shadow: 2px 1px 5px #;
	background-color: #FFF;
	font-family: arial;
	text-shadow: 2px 2px 7px #729053;
}
.menu_principale {
	font-family: arial;
	font-size: 18px;
	color: #033;
	background-color: #FFF;
	text-shadow: 2px 2px 2px #729053;
}
.myasdo_accedi_registrati {
	font-size: 14px;
	background-color: #DCFFD0;
	font-family: arial;
}
.myasdo {
	background-color: #DCFFD0;
}
.titoli_tabelle {
	font-size: 16px;
	color: #033;
	background-color: #FFF;
	font-family: arial;
}
.pie_di_pagina {
	font-size: 16px;
	color: #FFF;
	text-shadow: 2px 2px 2px #033;
}
a:link {
	text-decoration: none;
	color: #033;
}
.facebook {
	background-color: #FFF;
}
body,td,th {
	font-family: arial;
}
a:visited {
	text-decoration: none;
	color: #033;
}
.corpo_pagina {
	font-family: arial;
	color: #033;
	background-color: #FFF;
	text-align: center;
}
a:hover {
	color: #730315;
	text-decoration: none;
}
.sponsor {
	background-color: #FFF;
}
</style>
<script type="text/javascript">
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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 MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
</head>

<body class="sfondo" onload="MM_preloadImages('../CONTENUTI/OGGETTI HOME/myasdo2roll.gif')">
<div align="center">
  <table width="903">
    <tr>
      <td><img src="../barra top.jpg" width="899" height="140" align="middle" /></td>
    </tr>
  </table>
  <table width="903" height="34" border="0" align="center">
    <tr class="menu_principale">
      <td width="866" height="25" align="center" valign="middle" class="menu_principale"><a href="../index.php">home</a> ****<a href="../CONTENUTI/news.php">news</a> ****<a href="../CONTENUTI/campionato.php">campionato</a>**** <a href="../CONTENUTI/squadra.php">squadra</a>**** <a href="../CONTENUTI/societa.php">società</a>**** <a href="../CONTENUTI/storia.php">storia</a> ****<a href="../CONTENUTI/gallerie.php">gallerie</a> ****<a href="../CONTENUTI/link.php">link</a> ****<a href="../CONTENUTI/5xmille.php">5xmille</a> ****<a href="../CONTENUTI/dove siamo.php">dove siamo</a></td>
      <td width="27" height="25" align="center" valign="middle" class="facebook"><a href="http://www.facebook.com/pages/ASDO-Don-Orione/415035968514242"><img src="../CONTENUTI/OGGETTI HOME/facebook.gif" alt="" width="25" height="25" align="middle" /></a></td>
    </tr>
  </table>
  <table width="903" height="51" border="0">
    <tr valign="top">
      <td width="742" height="18" rowspan="2" align="center" valign="middle" class="titolo_pagina"><div align="center"><strong class="titolo_pagina1" id="news">recupero dati</strong></div></td>
      <td width="149" height="30" align="center" valign="middle" class="myasdo"><a href="../CONTENUTI/myasdo.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image7','','../CONTENUTI/OGGETTI HOME/myasdo2roll.gif',1)"><img src="../CONTENUTI/OGGETTI HOME/myasdo2.gif" alt="" name="Image7" width="135" height="24" border="0" id="Image7" /></a><a href="../CONTENUTI/myasdo.php"></a></td>
    </tr>
    <tr valign="middle">
      <td height="20" align="center" valign="middle" nowrap="nowrap" class="myasdo_accedi_registrati"><a href="autenticazione utente.php">login</a> * ****<a href="registrazione.php">registrati</a></td>
    </tr>
  </table>
  <table width="903" border="0">
    <tr>
      <td height="500" valign="top" class="corpo_pagina"><p>&nbsp;</p>
        <p></p>
        <p></p>
        <p align="center">    
	    </p>
        <p align="center">Al più presto riceverai un' e-mail con i dati di accesso...</p>
      <p align="center">&nbsp;</p><p align="center">&nbsp;</p></td>
    </tr>
  </table>
  <table width="903" height="178" border="0" align="center" cellpadding="3">
    <tr valign="bottom" class="titoli_tabelle">
      <td height="20" align="center" nowrap="nowrap"><strong class="titoli_tabelle">sponsor</strong></td>
    </tr>
    <tr class="sponsor">
      <td height="150" align="center" valign="top"><a href="http://ocres.webprofessional.it"><img src="../CONTENUTI/LOGHI SPONSOR/ocres.jpg" width="150" height="150" hspace="30" /></a> <a href="http://www.primspa.com/"><img src="../CONTENUTI/LOGHI SPONSOR/prim.jpg" width="150" height="150" hspace="30" vspace="0" /></a><a href="http://www.fondazioneroma-terzosettore.it/it/index.html"><img src="../CONTENUTI/LOGHI SPONSOR/fondazioneromaterzosettore.jpg" width="150" height="150" hspace="30" /></a><a href="http://www.gruppopellegrini.it/"><img src="../CONTENUTI/LOGHI SPONSOR/pellegrinispa.jpg" width="150" height="150" hspace="30" /></a>
        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"></td>
    </tr>
  </table>
  <br />
  <span class="pie_di_pagina">Associazione Sportiva Disabili Don Orione<br />
Via della Camilluccia 112/120, cap. 00135, Roma<br />
Tel. 06-355291</span></div>
<div align="center"></div>
</body>
</html>
<?php
mysql_free_result($recup);
?>
<?php
if (isset($_POST['Mail'])) 
{ 
 mysql_select_db($database_asdo, $asdo); 
$query=mysql_query("SELECT * FROM utenti WHERE id_utente = '1'"); 
$row_recup = mysql_fetch_assoc($recup);
$Username=$row_recup['Username']; 
$Password=$row_recup['Password']; 
$mittente = 'from:"utenti asdo"<[email protected]>';  
$a="[email protected]"; //destinatario 
$oggetto="recupero dati di accesso";  
$messaggio="$Username,$Password";  
mail($a, $oggetto, $messaggio, $mittente); 
}  
?>
 

minatore

Utente Attivo
25 Set 2007
410
0
0

Ciao, i dati non ti arrivano per questo motivo, ciò che ti ho scritto non è
PHP:
if (isset($_POST['Mail']))  
{  
 mysql_select_db($database_asdo, $asdo);  
$query=mysql_query("SELECT * FROM utenti WHERE id_utente = '1'");  
$row_recup = mysql_fetch_assoc($recup); //errore
$Username=$row_recup['Username'];  
$Password=$row_recup['Password'];  
$mittente = 'from:"utenti asdo"<[email protected]>';   
$a="[email protected]"; //destinatario  
$oggetto="recupero dati di accesso";   
$messaggio="$Username,$Password";   
mail($a, $oggetto, $messaggio, $mittente);  
}   
?>
ma questo
PHP:
if (isset($_POST['Mail'])) 
{ 
 mysql_select_db($database_asdo, $asdo); 
$query=mysql_query("SELECT * FROM utenti WHERE id_utente = '1'") 
$row_recup = mysql_fetch_assoc($query); 
$Username=$row_recup['Username']; 
$Password=$row_recup['Password']; 
$mittente = 'from:"utenti asdo"<[email protected]>';  
$a="xxx"; //destinatario 
$oggetto="recupero dati di accesso";  
$messaggio="$Username,$Password";  
mail($a, $oggetto, $messaggio, $mittente); 
}
sostituisci e fammi sapere se ti arriva qualcosa, intanto la provo pure io, non si sa mai
.ciao
 

minatore

Utente Attivo
25 Set 2007
410
0
0

Ok appena provata e funziona i dati arrivano, scrivi solo questo, altrimenti ti potrebbe dare errore se
PHP:
$_POST['mail']
non è convalidata, risolto il problema della ricezione, poi la adattimo al tuo script ciao
PHP:
mysql_select_db($database_asdo, $asdo);  
$query=mysql_query("SELECT * FROM utenti WHERE id_utente = '1'")  
$row_recup = mysql_fetch_assoc($query);  
$Username=$row_recup['Username'];  
$Password=$row_recup['Password'];  
$mittente = 'from:"utenti asdo"<[email protected]>';   
$a="xxx"; //destinatario  
$oggetto="recupero dati di accesso";   
$messaggio="$Username,$Password";   
mail($a, $oggetto, $messaggio, $mittente);
 

fabrizio74

Nuovo Utente
5 Set 2012
13
0
0
ciao,
niente da fare, mi continua ad arrivare solo la virgola, non so se sbaglio qualche altra cosa,
Nella terza riga ho messo il ";" in fondo che forse ti era sfuggito e mi dava errore.
ora con il seguente codice che mi hai detto di provare, quando premo il pulsante esce:
Parse error: syntax error, unexpected T_STRING in /web/htdocs/www.asdo.it/home/SESSIONE UTENTI/recupero dati ok.php on line 3

PHP:
$_POST['Mail']
mysql_select_db($database_asdo, $asdo);
$query=mysql_query("SELECT * FROM utenti WHERE id_utente = '1'");
$row_recup = mysql_fetch_assoc($query); 
$Username=$row_recup['Username'];   
$Password=$row_recup['Password'];   
$mittente = 'from:"utenti asdo"<[email protected]>';    
$a="[email protected]"; 
$oggetto="recupero dati di accesso";    
$messaggio="$Username,$Password";    
mail($a, $oggetto, $messaggio, $mittente);
 

minatore

Utente Attivo
25 Set 2007
410
0
0
ciao,
niente da fare, mi continua ad arrivare solo la virgola, non so se sbaglio qualche altra cosa,
Nella terza riga ho messo il ";" in fondo che forse ti era sfuggito e mi dava errore.
ora con il seguente codice che mi hai detto di provare, quando premo il pulsante esce:
Parse error: syntax error, unexpected T_STRING in /web/htdocs/www.asdo.it/home/SESSIONE UTENTI/recupero dati ok.php on line 3

PHP:
$_POST['Mail']
mysql_select_db($database_asdo, $asdo);
$query=mysql_query("SELECT * FROM utenti WHERE id_utente = '1'");
$row_recup = mysql_fetch_assoc($query); 
$Username=$row_recup['Username'];   
$Password=$row_recup['Password'];   
$mittente = 'from:"utenti asdo"<[email protected]>';    
$a="[email protected]"; 
$oggetto="recupero dati di accesso";    
$messaggio="$Username,$Password";    
mail($a, $oggetto, $messaggio, $mittente);
Ciao, fai cosi
PHP:
//qua metti la connessione al db
$query=mysql_query("SELECT * FROM utenti WHERE id_utente = '1'");
//controlla i dati nella tabella verifica se hai un campo id_utente e se lo stesso è uguale a 1
$row_recup = mysql_fetch_assoc($query);  
$Username=$row_recup['Username'];//contyrolla se username nella tabella è scritto con la maiuscola    
$Password=$row_recup['Password'];// come sopra controlla pure questo    
$mittente = 'from:"utenti asdo"<[email protected]>';     
$a="[email protected]";  
$oggetto="recupero dati di accesso";     
$messaggio="$Username,$Password";     
mail($a, $oggetto, $messaggio, $mittente);
lascia stare il tutto e metti solo questa parte in una pagina.php es. mail.php e falla girare sul web vedrai che funziona
Ciao se riesci a fare presto sono ancora in linea.
Buon lavoro
 

fabrizio74

Nuovo Utente
5 Set 2012
13
0
0
ho di nuovo controllato id 1 ok, Username e Password con la prima mauiscola ok
ora mettendo solo il seguente codice come dicevi
PHP:
 mysql_select_db($database_asdo, $asdo);
$query=mysql_query("SELECT * FROM utenti WHERE id_utente = '1'");
$row_recup = mysql_fetch_assoc($query);   
$Username=$row_recup['Username'];    
$Password=$row_recup['Password'];
$mittente = 'from:"utenti asdo"<[email protected]>';
$a="[email protected]";   
$oggetto="recupero dati di accesso";      
$messaggio="$Username,$Password";      
mail($a, $oggetto, $messaggio, $mittente);
mi esce:

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /web/htdocs/www.asdo.it/home/SESSIONE UTENTI/recupero dati ok.php on line 2

Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /web/htdocs/www.asdo.it/home/SESSIONE UTENTI/recupero dati ok.php on line 3

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /web/htdocs/www.asdo.it/home/SESSIONE UTENTI/recupero dati ok.php on line 3

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /web/htdocs/www.asdo.it/home/SESSIONE UTENTI/recupero dati ok.php on line 4

probabilmente sbaglio la connessione al db, il fatto è che usando Dreamweaver non so scrivere una riga di codice..
 

minatore

Utente Attivo
25 Set 2007
410
0
0
probabilmente sbaglio la connessione al db, il fatto è che usando Dreamweaver non so scrivere una riga di codice..
Non ti preoccupare, metti sopra questa riga, è la connessione
PHP:
<?php require_once('../Connections/asdo.php'); ?>
Ciao aspetto tue notizie
 

fabrizio74

Nuovo Utente
5 Set 2012
13
0
0
se dicevi così:

PHP:
require_once('../Connections/asdo.php');
$query=mysql_query("SELECT * FROM utenti WHERE id_utente = '1'");
$row_recup = mysql_fetch_assoc($query);   
$Username=$row_recup['Username'];    
$Password=$row_recup['Password'];
$mittente = 'from:"utenti asdo"<[email protected]>';
$a="[email protected]";   
$oggetto="recupero dati di accesso";      
$messaggio="$Username,$Password";      
mail($a, $oggetto, $messaggio, $mittente);

esce:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /web/htdocs/www.asdo.it/home/SESSIONE UTENTI/recupero dati ok.php on line 3
 

minatore

Utente Attivo
25 Set 2007
410
0
0
se dicevi così:

PHP:
require_once('../Connections/asdo.php');
$query=mysql_query("SELECT * FROM utenti WHERE id_utente = '1'");
$row_recup = mysql_fetch_assoc($query);   
$Username=$row_recup['Username'];    
$Password=$row_recup['Password'];
$mittente = 'from:"utenti asdo"<[email protected]>';
$a="[email protected]";   
$oggetto="recupero dati di accesso";      
$messaggio="$Username,$Password";      
mail($a, $oggetto, $messaggio, $mittente);

esce:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /web/htdocs/www.asdo.it/home/SESSIONE UTENTI/recupero dati ok.php on line 3

Metti questo subito dopo la connessione
PHP:
mysql_select_db($database_asdo, $asdo);
Ciao
 

fabrizio74

Nuovo Utente
5 Set 2012
13
0
0
ora dice:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /web/htdocs/www.asdo.it/home/SESSIONE UTENTI/recupero dati ok.php on line 4
 

minatore

Utente Attivo
25 Set 2007
410
0
0
ora dice:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /web/htdocs/www.asdo.it/home/SESSIONE UTENTI/recupero dati ok.php on line 4

Se ho capito bene, ci dovrebbe essere un errore nella query, ma nella pagina c'è altro codice?
 

minatore

Utente Attivo
25 Set 2007
410
0
0
no sto provando solo con quello

Ciao, sembra strano, una cosa sempli sta diventando un problemone, a me funziona bene, prova a postare la pagina di connessione inserendo delle "xxxx" al posto dei dati privati e vediamo come è fatta.
Adesso ti posto come faccio io la connessione, provala anche tu
pagina config.php
PHP:
<?php
$db_host="32.xxx.658.xxx";
$db_user="Sql5x8x54x";
$db_password="54xx5xxxx";
$db_name="Sql45xx5554x_1";
?>
pagina connect.php
PHP:
<?php
require'config.php';
$link=mysql_connect($db_host,$db_user,$db_password);
if(!$link)
{
die("errore 1:".mysql_error());
}
$db_selected=mysql_select_db($db_name,$link);
if(!$db_selected)
{
die("errore 2:".mysql_error());
}
?>
questi sono i 2 file di connessione, spero di non aver sbagliato (non ho fatto incolla, ma solo la copia).
PHP:
require 'config.php';
require 'connect.php';
$query=mysql_query("SELECT * FROM utenti WHERE id_utente = '1'"); 
$row_recup = mysql_fetch_assoc($query);    
$Username=$row_recup['Username'];     
$Password=$row_recup['Password']; 
$mittente = 'from:"utenti asdo"<[email protected]>'; 
$a="[email protected]";    
$oggetto="recupero dati di accesso";       
$messaggio="$Username,$Password";       
mail($a, $oggetto, $messaggio, $mittente);
Fai girare questi 3 file senza mettere niente in cartelle, se non funziona così mi rimetto all'aiuto degli esperti
Ciao
 
Discussioni simili
Autore Titolo Forum Risposte Data
9 Tomcat:Accesso dati sul filesystem Discussioni Varie 0
nim Accesso con dati di Facebook PHP 9
J Aggiornare dati accesso tramite cookie PHP 2
F accesso su tabelle access con dati comuni in campi diversi Classic ASP 0
max75 query su due tabelle e dati doppioni MS Access 2
K Form che manda dati doppi PHP 1
T problemi con dati menu a tendina HTML e CSS 2
D protezione cartelle: blocco visualizzazione/scaricamento contenuto, ma abilitazione utilizzo dati da parte di file .php presenti sul sito Web Server 1
D Risultati diversi elaborazione dati fra localhost e Altervista PHP 0
C Creare Tabella Dati Meteo prelevandoli da dei Tags in un altro foglio PHP 27
M Invio dati database via email php PHP 0
K [php]form invio dati PHP 0
peppe0703 Come Estrarre dati da db wordpress e richiamarli in html esterno HTML e CSS 0
V dati scomparsi dal sito HTML e CSS 3
M Memorizzare i dati nei campi prima dell'invio al db PHP 4
A Stampare dati da form PHP 8
E Estrarre dati da doppia tabella, banale ma non sempre PHP 1
Couting95 inserire dati da un file di testo in una tabella in php PHP 1
F Scrivere dei dati in word con php PHP 0
otto9due $_FILE non passa i dati dal form PHP 1
N dati tabella non presi PHP 1
M Riportare in tabella HTML dati estratti con query SQL MySQL 0
I Assegnare dati fetch request ad una variabile globale Javascript 0
L PHPSpreadsheet inserire dati da file .xlsx/.xls su database PHP 2
L Ricezione dei dati su file php da modulo html PHP 6
L inserimento form dati multipli ? PHP 0
S Leggere dati da API e visualizzarli PHP 0
S problema con recupero dati tabella mysql PHP 2
E Progressbar estrazione dati da tabella mySQL Ajax 9
A invio massivo dati a file php Javascript 4
M Inviare dati nel db dopo risposta alert PHP 0
A recuperare i dati passati nel post PHP 1
L Estrazione dati php Database 6
L Estrazione dati casuali non doppioni MySQL 1
F Leggere e aggiornare dati di campi <input text> su file di test PHP 0
J Form inserimento dati in database Ajax 1
D Recupero dati da HDD esterno Hardware 0
L non duplicare dati in stato "aggiornamento" PHP 6
L inserire dati multi livello PHP 8
L input (rilevare cambio dati) PHP 3
L input dati con inser into select ? PHP 4
W Invio Dati ad un altra pagina Classic ASP 1
A Mostrare dati database per pagine PHP 2
Samuele Ronzani Sposta dati in una tabella eliminandolo MySQL 6
S Gestire scelta dropdown con dati da Mysql PHP 2
C Estrarre dati stringa Sql Database 1
elpirata Query per leggere dati da una tabella mysql e mostrarli a video in base a parametri passati tramite GET PHP 5
W Evitare ridondanza dei dati Classic ASP 3
MarcoGrazia Dati nulli su join tra più tabelle MySQL 1
A Inserimento dati nel database tramite form + altre operazioni PHP 18

Discussioni simili