[insert_php]
if(
( isset($_POST[‘voxmail_nome’]) && $_POST[‘voxmail_nome’] !== “” ) &&
( isset($_POST[‘voxmail_cognome’]) && $_POST[‘voxmail_cognome’] !== “” ) &&
( isset($_POST[‘voxmail_email’]) && $_POST[‘voxmail_email’] !== “” )
){
include ( __DIR__.’/../../themes/twentyten/voxmail/wrapper.php’);
//init wrapper
$host = ‘m5v9s.mailrouter.it’;
$public_key = ‘bdf51addb0a31e95e5435d78678fd780’;
$private_key = ‘86460321e85ff734e63aaeb823333c39’;
service_init( $host, $public_key, $private_key );
$data = array(
‘+audiences’ => ‘hwvq2’, // gruppo in cui inserire l’utente, il codice si trova nella url
‘profile_name’ => $_POST[‘voxmail_nome’],
‘profile_surname’ => $_POST[‘voxmail_cognome’],
‘mail’ => $_POST[‘voxmail_email’]
);
//updating user, or creating if not exists
if ( service_user_update( $_POST[‘voxmail_email’] , $data , 1 ) ){
// print page ok, ringraziamenti, ecc…
echo_form_saved();
}else{ // print page error
echo_form_data_error();
echo service_errormessage().”;
echo service_errorcode().”;
}
}else{
echo_form_data_error();
}
function echo_form_saved(){
echo ‘
Merci de vous etre inscrit à notre newsletter !
‘;
} //echo_form_saved()
function echo_form_data_error(){
echo ‘
error while saving data
‘;
} //echo_form_data_error()
[/insert_php]