<?
include "cnn.php";
?>
<h1>Recuperar Senha: Passo 2/2</h1>
<div class="quadros">
<?  
$sql_vip_check = mssql_query("SELECT vip FROM MEMB_INFO WHERE memb___id='$login'");
list($vip_code) = mssql_fetch_array($sql_vip_check);

$sql_username_check = mssql_query("SELECT memb___id FROM MEMB_INFO WHERE memb___id='$login'"); 
$username_check = mssql_num_rows($sql_username_check); 


$sql_mail_check = mssql_query("SELECT mail_addr FROM MEMB_INFO WHERE mail_addr='$email' and memb___id='$login'"); 
$sql_pw_check = mssql_query("SELECT memb__pwd, fpas_ques FROM MEMB_INFO WHERE fpas_ques='$oldpwd' and memb___id='$login' and fpas_answ='$newpwd' "); 
$sql_pw_get = mssql_query("SELECT memb__pwd, fpas_ques FROM MEMB_INFO WHERE memb___id='$login' "); 
$pw_check = mssql_num_rows($sql_pw_check);
$pw_retrieval = mssql_fetch_row( $sql_pw_get );
$mail_check = mssql_num_rows($sql_mail_check);
 

if (empty($login) || empty($newpwd) || empty($oldpwd) || empty($email)) {
    echo "Preencha todos os campos.<br>";
}

elseif ($username_check <= 0)
	{ 
        echo "Sua conta n&atilde;o existe em nosso banco de dados.<br>"; 
	}

elseif ($pw_check <= 0)
	{ 
        echo 	"Sua pergunta secreta esta errada.<br>"; }
		
elseif ($vip_code == 0){
echo "Desculpe, mas este recurso s&oacute; pode ser utilizado por contas VIP.<br>"; }
	
	
elseif ($mail_check <= 0)
    { 
    echo "Seu e-mail esta errado!<br>
    "; 
    }

else 
	{	
	echo "Sua senha &eacute; <strong>$pw_retrieval[0]</strong><br />
	V&aacute; no Painel de Controle e mude sua Senha!";
	}


?></div>