i have a newsletter script that saves to a textfile and shows all from said file; the problem is it runs the email addresses together like so: "glenn@theartuary.comowner@thecrimsonmoon.com" - i was hoping someone could show me how to edit the script to make it print them separately... Please?
code for saving the address to file:
// save to listfile
$fp = fopen($cfg['file'], "a+");
flock($fp, 2);
$ok = fputs($fp, trim($_GET['mail'])."\n" );
flock($fp, 3);
fclose($fp);
if($ok) return "<div id='box'>".THANKS_SAVED."</div>";
else return "Sorry, could not save email ...";
}
code for showing all in the webpage:
/ show all eMail's in list /
function showall() {
global $cfg;
// get them
$fp = fopen($cfg['file'], "r");
$str = fread( $fp, filesize($cfg['file']) );
fclose($fp);
clearstatcache();
$adr = explode("%", $str);
asort($adr);
<?php echo "[ <a href='".$_SERVER['PHP_SELF']."?secure=".$_GET['secure']."' title='menu'>back to menu</a> ]"; ?>
<p>
<h3>All Addresses in List sorted from A - Z</h3>
<b>Click one to delete!</b>
<p>
<div id='box'>
<?php
// print them
foreach($adr as $mail) {
if($mail != "") echo "\n\t<li><a href=\"javascript:del('".$_SERVER['PHP_SELF']."?act=unsubscribe&mail=".$mail."','".$mail."')\" title=\"delete ".$mail."\">".$mail."</a>"-</li>";
}
echo "\n</div>\n";
}
i appreciate whoever can help very much,
glenn