Ciao a tutti, ho un problema con una parte di codice, riguarda la funzione che cliccando il link arrivato per email fa attivare l'account. Io quando clicco sul link mi dice poi che il codice di conferma è errato.
La funzione è la seguente, e non sono sicuro che sia qui l'errore.
Potete darmi una mano?
Grazie
codice:
function UpdateDBRecForConfirmation(&$user_rec) {
if(!$this->DBLogin())
{
$this->HandleError("Fallito il login col DB!");
return false;
}
$confirmcode = $this->SanitizeForSQL($_GET['code']);
$result = mysql_query("Select name, email from $this->tablename where confirmcode='$confirmcode'",$this->connection);
if(!$result || mysql_num_rows($result) <= 0)
{
$this->HandleError("Codice di conferma errato.");
return false;
}
$row = mysql_fetch_assoc($result);
$user_rec['nome'] = $row['nome'];
$user_rec['email']= $row['email'];
$qry = "Update $this->tablename Set confirmcode='y' Where confirmcode='$confirmcode'";
if(!mysql_query( $qry ,$this->connection))
{
$this->HandleDBError("Error inserting data to the table\nquery:$qry");
return false;
}
return true;
}