<?php

include_once("connect.php");

	mysqli_query($conexao,"SET NAMES 'utf8'");
    mysqli_query($conexao,'SET character_set_connection=utf8');
    mysqli_query($conexao,'SET character_set_client=utf8');
    mysqli_query($conexao,'SET character_set_results=utf8');
    
    $id = $_GET['id'];
    $id = base64_decode($id);
//    exit;

if(!empty($id)){
$consulta_email = "select * from oc_customer where email = '$id' and st_termo = 0";
    		$result_consulta_email = mysqli_query($conexao, $consulta_email) or die(mysqli_error($conexao));
            if(mysqli_num_rows($result_consulta_email)>0){
                $update_status = "update oc_customer set 
    										st_termo = 1 
    								where email = '$id'";        
                    
               
            
            mysqli_query($conexao, $update_status) or die ($conexao);
            $mensagem = "Aviso: E-mail confirmado com sucesso!";
    echo "<script>alert('Email confirmado com sucesso!')</script>";
    exit;
            }
}
    echo "<script>alert('Erro! Conta já ativada')</script>";
    exit;


?>

