1
Good mornig Xoopers... I have a little problem. I'm trying to incorporate this little script in a central block so tha my users can register to the mailing list that my provider gave it to me.. When i put it in a center block changing to php, i get a blank block. Nothing happens. Maybe the problem could be the mix of php and html ?
here is the script
//'''''''''' inserire il nome del dominio
$DOMAIN='yourdomain.com';
//'''''''''' inserire il nome della lista o delle liste
$LISTS[]='your_list';
$LISTS[]='altra_lista';
//''''''''fine configurazione
$response_template='
%%ACTION%% %%LIST%%@%%DOMAIN%% |
Riceverai una mail a breve su "%%ADDRESS%%". Quello che devi fare è usare la funzione "Rispondi" del tuo client di posta ed inviare tale risposta: non è necessario scrivere nulla. |
';
?>
Iscrizione a mailing-list in php
switch ( $_POST['action'] ) {
case 'subscribe':
if ( !empty($_POST['addy']) ) {
if ( mail($list.'-subscribe-'.str_replace('@', '=', $_POST['addy']).'@'.$DOMAIN ,'', '') ) {
show_tpl($response_template, 'ISCRITTO A: ', $list, $DOMAIN, $_POST['addy']);
}
}
break;
case 'unsubscribe':
if ( !empty($_POST['addy']) ) {
if ( mail($list.'-unsubscribe-'.str_replace('@', '=', $_POST['addy']).'@'.$DOMAIN ,'', '') ) {
show_tpl($response_template, 'RIMOSSO DA: ', $list, $DOMAIN, $_POST['addy']);
}
}
break;
}
function show_tpl($tpl, $action, $list, $domain, $address) {
$tpl=str_replace('%%ACTION%%', $action, $tpl);
$tpl=str_replace('%%LIST%%', $list, $tpl);
$tpl=str_replace('%%DOMAIN%%', $domain, $tpl);
$tpl=str_replace('%%ADDRESS%%', $address, $tpl);
echo $tpl;
}
?>