<?php

function atualiza_emails($emails)
{
    $CI =& get_instance();
    
    $CI->load->model('eventos/emails_model');
    
	$arrayEmails = explode(',', $emails);
	
	foreach ($arrayEmails as $value)
	{
		$consulta = $CI->emails_model->consulta_cadastro($value);
		if($consulta == FALSE)
		{
			$CI->emails_model->insere_email($value);
		}
		$CI->emails_model->aumenta_popularity($value);
	}
	
	return true;	
}