Ho una mailing list con aruba...e proprio aruba mette sul suo sito a disposizionedei clienti uno script php da inserire nelle proprie pagine, questo:
Codice PHP:
<?php
//'''''''''' inserire il nome del dominio
$DOMAIN='masterbass.com';
//'''''''''' inserire il nome della lista o delle liste
$LISTS[]='testami';
$LISTS[]='altra_lista';
//''''''''fine configurazione
$response_template='
<center>
<div align="center">
<table border="0" cellspacing="1" cellpadding="2" width="570">
<tr>
<td align="center">
%%ACTION%% %%LIST%%@%%DOMAIN%%
</td>
</tr>
<tr>
<td class="response">
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.
</td>
</tr>
</table>
</div>
</center>
';
?>
<html>
<head>
<title>Iscrizione a mailing-list in php</title>
<style>
body {
background-color:#ffcb8c;
color:white;
}
td { background-color:#ffcb8c; color:red; font-weight:bold;font-family:verdana;}
td.response { background-color:#ffca000; color:red; font-weight:normal; font-family:verdana; }
</style>
</head>
</body>
<center><div align="center">
<table border="0" cellspacing="0" cellpadding="0" width="570">
<form method="post">
<tr>
<td align="center">Indirizzo email</td>
<td align="center">Nome Lista / Azione</td>
<td align="left"></td>
</tr>
<tr>
<td align="center"><input type="text" value="<?php echo $_GET['a']; ?>" name="addy" size="30"></td>
<td align="center"><select name="list"><?php
if ( is_array($LISTS)) {
foreach ( $LISTS as $val ) {
echo '<option value="'.$val.'">'.$val.'@'.$DOMAIN.chr(10);
}
}
?></select><select name="action"><option value="subscribe">Iscriviti<option value="unsubscribe">Rimuovi iscrizione</select></td>
<td align="left"><input type="submit" value="GO!"></td>
</tr>
</form>
</table>
</center></div>
<?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;
}
?>
</body>
</html>
Io vorrei eliminare da questo codice la select che da la possibilità di scegliere a quale mailing-list iscriversi (ne ho solo 1
). Credo sia questo:
Codice PHP:
<select name="list"><?php
if ( is_array($LISTS)) {
foreach ( $LISTS as $val ) {
echo '<option value="'.$val.'">'.$val.'@'.$DOMAIN.chr(10);
}
}
?></select>
Il fatto è che se elimino questa parte lo script non funziona più...ho provato in mille modi!
Potete aiutarmi?? Grazie!