allora,

durante l'scrizione invio un codice di conferma all'indirizzo email per attivare l'account.

qui tutto ok.

il problema è quando devo fare il login.


prima di effettuare i select del username e password e poi creare la sessione vorrei vedere se il campo attvato, per quel username è uguale a si(cioe che è attivto).

ho provato con un if ma mi da sempre che l'acccount non è attivato.

un aiuto??

Codice PHP:
<?
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_love "xxx";
$database_love "xxx";
$username_love "xxx";
$password_love "xxxxx";
$love mysql_pconnect($hostname_love$username_love$password_love) or trigger_error(mysql_error(),E_USER_ERROR); $user="$_POST[username]";
$r2 "$row_Recordset1[attivato]";
$r "si";
?><?
mysql_select_db
($database_love$love);
$query_Recordset1 "SELECT attivato FROM utenti WHERE username = '$user'";
$Recordset1 mysql_query($query_Recordset1$love) or die(mysql_error());
$row_Recordset1 mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 mysql_num_rows($Recordset1);

?>
<?php

{


   if(
$r==$r2)
   {
      
      
      
      
      
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  
session_start();
}

$loginFormAction $_SERVER['PHP_SELF'];
if (isset(
$_GET['accesscheck'])) {
  
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset(
$_POST['username'])) {
  
$loginUsername=$_POST['username'];
  
$password=$_POST['password'];
  
$MM_fldUserAuthorization "";
  
$MM_redirectLoginSuccess "welcome.php";
  
$MM_redirectLoginFailed "error.php";
  
$MM_redirecttoReferrer false;
  
mysql_select_db($database_love$love);
  
  
$LoginRS__query=sprintf("SELECT username, password FROM utenti WHERE username=%s AND password=%s",
    
GetSQLValueString($loginUsername"text"), GetSQLValueString($password"text")); 
   
  
$LoginRS mysql_query($LoginRS__query$love) or die(mysql_error());
  
$loginFoundUser mysql_num_rows($LoginRS);
  if (
$loginFoundUser) {
     
$loginStrGroup "";
    
    
//declare two session variables and assign them
    
$_SESSION['MM_Username'] = $loginUsername;
    
$_SESSION['MM_UserGroup'] = $loginStrGroup;          

    if (isset(
$_SESSION['PrevUrl']) && false) {
      
$MM_redirectLoginSuccess $_SESSION['PrevUrl'];    
    }
    
header("Location: " $MM_redirectLoginSuccess );
  }
  else {
    
header("Location: "$MM_redirectLoginFailed );
  }
}
      
      
      
   }
   else
   {
      print 
"<html><head><title>Account Non Attivato</title></head> <body>
<BR
<div style=\"font-family:verdana,tahoma\" align=\"center\">Il codice d'attivazione non è corretto.
Contatta il  <a href=\"mailto:help@xxx.net\">supporto utenti</a>/div><body></html>"
;
   }

}

?>
<?php
mysql_free_result
($Recordset1);
?>